DEV Community

loading...

Discussion on: Native HTML: Dialog boxes

link2twenty profile image
Andrew Bone Author • Edited

There is an issue on the spec's GitHub, no idea if it will go anywhere but may as well have a look.

Have some way of opening `` elements without JavaScript #3567

keithamus avatar
keithamus commented on Mar 14, 2018

dialog elements are a great addition and I'm glad they're getting implemented, but a key part of their functionality relies on JavaScript: to open a <dialog> you need to use JavaScript to set the open attribute.

It'd be great if there was a way to make a <a> or a <button> elements capable of opening dialogs.

Precident already exists for page interactivity baked into HTML - for example <a href="#.."> can already scroll the page, and <details> elements are capable of hiding elements behind interactivity, so I think it stands to reason <dialog> elements could be opened by other page elements.

Thread Thread
lexlohr profile image
Alex Lohr

I have added a comment to your proposal.

Thread Thread
link2twenty profile image
Andrew Bone Author

I saw that 😀

Thread Thread
link2twenty profile image
Andrew Bone Author • Edited

Worth noting HTML is not case sensitive so the opensModal attribute would have to be opens-modal