3 ms·
Dark patterns with the HTML 5.2 tag and Chrome for fun and profit
- Nadya 9y agoThis is nothing you couldn't already do in Javascript with a simple <div> and some code. The dialogue element just gets rid of some of the boilerplate HTML and implements some common functions you'd use for such a modal popup as an official API. If anything this will prevent people using 3rd party code to handle modal popups. >Adding a listener over a close button to make it nearly impossible for the user to close it. Already possible with Javascript and any old element. >Having a close button that when pressed closes the modal but also triggers an undesirable path. Also already a thing by using an eventListener or callback. >2 Buttons that send you into an loop of death in creating modals. Also already possible with just Javascript. >Hijacking the Escape (and Tab) button Broken record: Already possible just with Javascript. TL;DR: Don't run untrusted 3rd party code Here's a button that when you click overlays a div (which could also be added through Javascript but I'm feeling lazy) that tells you to press ESC but I hijack the ESC key to tell you that you pressed a bad key: https://codepen.io/anon/pen/paJqbm https://codepen.io/anon/pen/paJqbm Forked from his example.