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

Close requests and close watchers #215

Closed
domenic opened this issue Jun 28, 2023 · 8 comments
Closed

Close requests and close watchers #215

domenic opened this issue Jun 28, 2023 · 8 comments
Labels
from: Google Proposed, edited, or co-edited by Google. position: neutral topic: html Spec relates to HTML (Hypertext Markup Language) topic: web apis Spec relates to web APIs (entry points for script) venue: WHATWG HTML Workstream venue: WICG Proposal is incubated in the Web Incubator Community Group

Comments

@domenic
Copy link

domenic commented Jun 28, 2023

WebKittens

@annevk and @othermaciej have both previously reviewed this

Title of the spec

Close signals and close watchers

URL to the spec

https://html.spec.whatwg.org/multipage/interaction.html#close-requests-and-close-watchers

URL to the spec's repository

https://github.com/WICG/close-watcher

Issue Tracker URL

No response

Explainer URL

No response

TAG Design Review URL

w3ctag/design-reviews#594

Mozilla standards-positions issue URL

mozilla/standards-positions#604

WebKit Bugzilla URL

No response

Radar URL

No response

Description

In addition to the WICG repository with the explainer, see the HTML Standard pull request: whatwg/html#9462

The main new API introduced here is the CloseWatcher API. But this spec also includes changes to unify dialog, popover, and fullscreen handling into a single "close watcher" concept, which is triggered by a platform-independent concept of "close request".

For macOS and keyboard-attached iOS devices, the close request would be the Esc key. For other iOS devices, there might not be a close request. This was previously discussed in WICG/close-watcher#11 ; see also https://github.com/WICG/close-watcher/blob/main/platform-implementation-notes.md . In such cases, it would still be ideal for the API to exist and be implemented, and just never triggered via user action, so that developers can write platform-agnostic code (e.g. centralizing their close logic into the close event handler of a CloseWatcher object).

Because of how close request gestures can serve multiple purposes, e.g. the Android back button/gesture being used to navigate session history, the specification has some anti-abuse measures to prevent the close signal gesture from being indefinitely captured by web developers using dialogs, popovers, or CloseWatchers. These measures might not be necessary in the macOS/iOS-with-keyboard ecosystem, where the Esc key is the only relevant gesture and it does not serve another purpose. But we think they're still reasonable, and should be implemented uniformly across platforms for interoperability. This was previously discussed from one angle in WICG/close-watcher#10.

@lukewarlow lukewarlow added topic: html Spec relates to HTML (Hypertext Markup Language) topic: web apis Spec relates to web APIs (entry points for script) venue: WHATWG HTML Workstream venue: WICG Proposal is incubated in the Web Incubator Community Group from: Google Proposed, edited, or co-edited by Google. labels Jun 28, 2023
@lukewarlow lukewarlow moved this from Unscreened to Needs assignees in Standards Positions Review Backlog Aug 1, 2023
@domenic domenic changed the title Close signals and close watchers Close requests and close watchers Aug 10, 2023
@annevk
Copy link
Contributor

annevk commented Aug 25, 2023

Is there an explanation somewhere as to why Android cannot synthesize Esc key events to simulate the existing convention for close requests on other platforms? At least from a distance this seems like a lot of new functionality for a feature that essentially already exists.

@domenic
Copy link
Author

domenic commented Aug 25, 2023

@lukewarlow
Copy link
Member

@lukewarlow
Copy link
Member

lukewarlow commented Dec 14, 2023

Just as an fyi this has been merged into the html spec and shipped in chromium 120

@lukewarlow
Copy link
Member

This has gone through some iteration in the spec and chrome implementation to handle some edge cases better. As a result it should be even more stable to implement in WebKit. It would be good to get an official signal of support or feedback on possible changes to achieve that, (especially as it's currently unshipped in chrome while it went through some of these changes)

@annevk
Copy link
Contributor

annevk commented May 13, 2024

Colleagues and I looked at this again and are still not entirely convinced it's worth the complexity given that for Apple platforms at least this is essentially what the Esc key is for. Something centered around that would have been more palatable. However, as we do see the need for some API in this space and the main downside of CloseWatcher is its verbosity we suggest closing this with "position: neutral" one week from now.

@lukewarlow
Copy link
Member

@domenic could you update the URL to point to the actual spec at https://html.spec.whatwg.org/multipage/interaction.html#close-requests-and-close-watchers and the URL repo link to point to the html spec? Else the links on webkit.org will end up being outdated.

@annevk
Copy link
Contributor

annevk commented May 21, 2024

I updated the URL. The repository still seems accurate? It's not archived anyway.

Will update webkit.org later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
from: Google Proposed, edited, or co-edited by Google. position: neutral topic: html Spec relates to HTML (Hypertext Markup Language) topic: web apis Spec relates to web APIs (entry points for script) venue: WHATWG HTML Workstream venue: WICG Proposal is incubated in the Web Incubator Community Group
Development

No branches or pull requests

3 participants