ugh I was so excited to see pure HTML modals were a thing with <dialog> only to find out there's no way of triggering them without JavaScript. Using pure HTML you can only dismiss them, not trigger them.
> 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.
I don't see the higher purpose of "HTML only" if that means we need to extend HTML with scripting capabilities. In that case I rather just use JavaScript.
Users might prefer, say, that 99% of the time a data selection widget behaves the same whenever accessed by their browser. When devs choose a JS UI library then that's usually what users get. Wouldn't it be good to have all tables have the same features (sort, collapse, column-select, data export), rather than only having rich features if the dev implemented them, duplicating the effort of millions of other devs.
There's a sliding scale here, with html at one end and each page ships a parser and libraries at the other - why have an img tag, just let the page developer implement a JS based interpreter?
There are useful tricks to changing CSS properties via checkbox state and pseudo-selectors to implement simple modals (which won’t be accessible), but you can’t open a modal <dialog> element without JS.
Weirdly, you can close them with a form submission, but you can’t open them with one.
https://github.com/whatwg/html/issues/3567
> 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.