-
Notifications
You must be signed in to change notification settings - Fork 218
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
[Popup] Light dismiss "escape key" should probably include all close signals #457
Comments
I was just going to raise another issue about the Escape key, but I think it might make sense to discuss it as part of this issue. During implementation, the question has come up about whether the Escape key light dismiss behavior (or really, any of the light dismiss behavior such as clicking outside) should be author-cancellable. I.e. user hits Escape, but author has added 'keydown' event handler on document.body, and does If you think this should be a separate issue, I'm happy to open one. |
Oh, I think this is a great discussion to have here. It connects in interesting ways. First, I think the platform needs to have both author-cancelable and non-cancelable close signals. Notably, exiting fullscreen cannot be author-cancelable. But, exiting a Second, I think that the behavior should be uniform. So, you can prevent dialog closing by (Note: the modal close signals explainer was written before I realized this about dialog. Per slightlyoff/history_api#13, we're probably going to update the event name for I don't have a strong opinion on which category Now, there's an interesting wrinkle for author-cancelable close signals regarding the Android back button, which is that canceling them can be used to trap the user by disabling the back button. Our modal close signals explainer has some mitigations for this, and for platform predictability, it applies those mitigations on all platforms. P.S. it's kind of annoying to talk about these things because events are cancelable ( |
Thanks @domenic! The original issue topic seems like a good one to port over to Open UI when we bring the proposal there for incubation. The group has been working on a full/shared definition of light dismiss (possibly that could be ported into the HTML spec at some point?). I imagine your feedback applies to light dismiss as generalizable behavior, as opposed to just applicable to popups. Cancelable-or-not for |
The popup explainer says
@dvoytenko and I have been working on https://github.com/slightlyoff/history_api/blob/master/history_and_modals.md, which is quite related. We believe that this escape key mention should probably be expanded to cover all "close signals", including:
@natechapin is working on a Chromium implementation of this concept, that so far intercepts both the desktop Esc key and the Android back button.
Our plan is to have all parts of the platform which use these close signals, e.g. the fullscreen API or the
<dialog>
element, use a core unified definition. Hopefully<popup>
will too.(Separately, some of the explainer linked above also talks about a
ModalCloseWatcher
class to allow direct developer handling of close signals. But, that would just be another consumer of this core "close signal" concept. The overlap with<popup>
is about the hopefully-shared concept.)The text was updated successfully, but these errors were encountered: