Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a method to make truly modal Dialog elements #281

Open
hituro opened this issue Nov 7, 2023 · 3 comments
Open

Add a method to make truly modal Dialog elements #281

hituro opened this issue Nov 7, 2023 · 3 comments
Assignees
Labels
enhancement New feature or request todo Make this happen

Comments

@hituro
Copy link

hituro commented Nov 7, 2023

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> or alert() 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 to Dialog.setup()/Dialog.create()to optionally lock it.

@hituro hituro added the enhancement New feature or request label Nov 7, 2023
@tmedwards tmedwards self-assigned this Nov 9, 2023
@tmedwards tmedwards added the todo Make this happen label Nov 9, 2023
@tmedwards
Copy link
Owner

tmedwards commented Nov 9, 2023

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.

@hituro
Copy link
Author

hituro commented Nov 9, 2023

Is esc supposed to close Dialog elements? It doesn't do so for me on Firefox or Chrome (Mac).

@tmedwards
Copy link
Owner

There's no Escape handling for Dialog at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request todo Make this happen
Projects
None yet
Development

No branches or pull requests

2 participants