Open hituro opened 10 months ago
Preface. This idea specifically, and making Dialog
act closer to browser modals in general, is something I've thought of before and I'll probably end up doing something.
That said. You're not actually required to interact with a modal. There are less ways to escape one, however, hitting the Escape key does close modals, both browser built-ins and <dialog>
s in modal mode—in non-modals it selects the first non-disabled button. The point is that bringing Dialog
into closer parity with browser modal behavior, by removing the title bar close button and overlay (backdrop) interaction closing, isn't going to force users to interact with modals more.
Is esc
supposed to close Dialog
elements? It doesn't do so for me on Firefox or Chrome (Mac).
There's no Escape handling for Dialog
at the moment.
The
Dialog
element represents a modal, but there is no provision for a dialog that cannot be cancelled out of using the close box, background-click, or keyboard close methods. While it is possible for an author to disable or hide each of these methods for a particular Dialog, it is not trivial, and requires a close handler to restore the disabled functionality.It would be great to optionally have a given Dialog be "truly modal" and require the user to actually take some action within the dialog to close it (like the HTML
<dialog>
oralert()
but with better styling).My tentative suggestion would be a
Dialog.lock()
method that is chainable and does the locking. An alternative would be to add another argument toDialog.setup()/Dialog.create()
to optionally lock it.