WICG / close-watcher

A web API proposal for watching for close requests (e.g. Esc, Android back button, ...)
https://html.spec.whatwg.org/multipage/interaction.html#close-requests-and-close-watchers
71 stars 5 forks source link

Which document should be targeted? #21

Open jakearchibald opened 2 years ago

jakearchibald commented 2 years ago

Some close signals don't target a specific document, such as Android's 'back' action. In a page containing iframes, which document gets the signal?

Option 1: Always the top level. Option 1a: …unless an element in an iframe is full-screen, in which case it goes to the iframe. Option 2: Whichever document last had focus. Option 3: The stack is moved to the traversable. If the close action targets a particular document (such as esc key), then it takes the last item on the stack for this document. Otherwise, it's the last item on the stack.

Option 3 could get complicated due to all the thread hopping.