3 ms·
> I'm with you... would be nice to have: You can do this right now already: // For opening <button onclick='document.querySelector("#dialogId").showM
by lelanthran 2y ago
> I'm with you... would be nice to have:
You can do this right now already:
// For opening
<button onclick='document.querySelector("#dialogId").showModal()'>Open</button>
// For closing
<button onclick='this.closest("dialog").close()'>Close</button>
I think the problem here is that it is impossible to actually use the result from `close()`, as it can return a status, IIRC.
> It would just make so much sense.
That way above that I propose is about as sensible as the way you propose. If there are any problems with my proposal that are solved by your proposal, I'd love to hear it.
- tracker1 2y agoThe point was to be able to do it without JS.
- lelanthran 2y agoI understand, but from a pragmatic viewpoint, it is no more and no less complicated to do it with `onclick` JS than it would be to do it with some other attribute. For all practical purposes, there is no difference between the two. I understand that the `onclick` wouldn't fire in browsers where JS is turned off, but in that case (no JS) you're going to have an awful user experience using dialogs even with builtin open/close attributes for dialogs.