-
Notifications
You must be signed in to change notification settings - Fork 214
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] multiple popups colliding? #433
Comments
Thanks for the comments here. So the current explainer (and Chromium implementation) has this behavior:
You are correct that malicious iframes could indeed close visible popups this way, or spoof a site's popups with their own. I'm not sure of a good mitigation strategy here. @melanierichards @gregwhitworth P.S. Nice profile picture. |
The top layer stack is per document, so I don't think actions taken in an iframe need to impact another document's top layer UX. Light dismissal includes loss of focus, so I wouldn't expect a document that isn't active to be able to display a popup. I'm thinking that helps ensure correct UX so that transient UX like a popup wouldn't be displayed in multiple documents at once. We have some related language in the explainer about this here, but we could be more explicit about these types of cross document interactions. Does that sufficiently mitigate the "iframe popup DOS"? |
Wait, what is the X in "one popup per X"? I was assuming it'd be If it's
Note that all documents have indepdent "currently focused area"s. That is, |
Yes it is document.
There's only one active document though. If focus leaves that active document, because the browser or tab or document lost focus, then I expect its popups to be dismissed. So the active document seems relevant in that we should answer the question what happens when Let me know if you disagree with any of that thinking. |
No, that's not correct. There is one active document per browsing context, but there are many many browsing contexts. (One for each window, and one for each iframe.) The inactive documents are just the documents in bfcache. |
In general any kind of way in which documents can affect each other is pretty unusual on the web platform, and poses some security and privacy issues. I'd definitely suggest sticking to everything being document-scoped, and not giving any particular document special treatment. |
Sorry, and thanks @BoCupp-Microsoft and @domenic . I'm not sure where my head was at when I responded above, I had Shadow DOM on my brain at the moment. You are of course correct that There will be the possibility that multiple components with separate Shadow DOM can step on each other's popups, but as @domenic pointed out, they already have DOM access so anything is already possible.
This is an interesting point. I agree that if the browser (tab/document/etc) loses focus, its popups should close. That feels like "light dismiss". Given @domenic's points above, this might be moot. But it would be more surprising if non-focused documents (e.g. a non-focused |
The explainer suggests that only one popup can be visible at a time.
What happens when one
popup
is currently showing and theshow()
method is called on anotherpopup
element/anchor? Does the first one automatically close, or is the second one ignored?If the first one is auto-closed, does this count as "light dismissal" (even though it might be purely by script and not user interaction) in terms of the
hide
event firing? Or if the second one is just ignored, is there a way to detect that your popup didn't actually open?Speaking of that, are there any other cases/conditions where you can try to open a popup and it might fail? Can you detect those failures if so, like with a
true
orfalse
being returned from theshow()
call?I'm assuming the former, that the first popup is closed when the second one starts to open. That seems most natural.
However, this concerns me in the potential for DOS-like behavior. Can't "malicious" code (like ads, browser extensions, etc) interfere with, or even completely suppress, a site's normal popups (like select boxes, for example) by trying to popup a hidden (or even hijacking/clickjacking) popup and thus replace the site's intended popup?
Would it be useful to have default behavior be that a popup will not allow itself to be closed by another popup trying to open... but that you could opt your popup into "auto-closing" behavior with an additional attribute, in case you prefer that on your site? Or the reverse: default to auto-closing but allow opting out of that with an attribute?
Also, is
show()
sync or async? Like, could my script immediately detect/manipulate the popup aftershow()
was called, or do you have to wait briefly (or poll) to be sure? If async, canshow()
return a promise that's fulfilled when it's completely opened (and potentially rejected if there's any cases where popup opening may fail)?The text was updated successfully, but these errors were encountered: