DEV Community

Tane Piper
Tane Piper

Posted on

Dark patterns with the HTML 5.2 <dialog> tag and Chrome for fun and profit

Recently I had some fun with the new <dialog> HTML tag and I created a CodePen and blog post with details of the experiments.

There are some glaring security issues around using the dialog and hopefully these can be addressed.

I'm also quite proud of this hack, and I was surprised how many things I was able to do to get the users to click the button I wanted.

Edit: As a follow up, I've started writing a web component that covers some of the security concerns. Here it maintains a global state and emits an event if there is already a modal open. I also want to try use observables to strip the rights of any dialogs on the page to show without the library controlling it. It's still a proof of concept however.

Top comments (1)

Collapse
 
peter profile image
Peter Kim Frank

This is brilliant, and brilliantly devious. 😈