You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Standardize a popup's condition and UI opened by window.open #5872
it would be nice to standardize the condition for popup etc, that will help web developers to figure out what to write in features parameter of window.open,
Also, I would be nice if we can standardize popup window's look-and-feel.
First, I'd like to gather opinion from browser developers about:
the reasoning behind the current condition for popup/window/tab
concern for changing/standardizing the condition
the reasoning behind the popup window's UI (why location bar is read-only or hidden, why toolbar etc are hidden)
Thanks for investigating these topics and promoting cross-browser consistency! Here are some initial thoughts as a Chromium developer proposing semi-related Screen/Window changes/APIs (but limited web-platform experience):
the reasoning behind the current condition for popup/window/tab
Others might have historical perspective on conditions, but I suspect Chromium inherited Webkit behavior and made incremental changes over time to address specific cases; it may be difficult to capture that history, I hope other folks will chime in.
concern for changing/standardizing the condition
Standardizing popup/window/tab conditions seems desirable. Introducing a new explicit feature string parameter e.g. 'type=tab' could clarify intent of the request (for this poorly-shaped API). Considering the space of web application manifest display modes in tandem would be very nice. The opener's window type (tab/popup/web-application/etc.) may also influence the resulting window type or UI details (e.g. web-app popup in Chromium).
the reasoning behind the popup window's UI (why location bar is read-only or hidden, why toolbar etc are hidden)
I don't have historical perspective here, but each implementer would probably cite some overlapping set of reasons (e.g. they weren't primarily meant to be user-navigable surfaces; they're designed to minimize frame UI/dimensions and accompany a 'main' browser window; etc.). Chromium even has slightly different styling for popups from web application windows, which use the web application out-of-scope navigation info-bar in lieu of a read-only location bar :-/
concern for changing popup window's UI
It may be detrimental to rigorously specify UI elements, dimensions, or characteristics. While some window.open features were designed for ui specification (thank you for iterating on that documentation!), they've obviously fallen out of favor. On the other hand, I'd personally like to see some advances and consistency in popup window design.
This looks nice, that it also defines fallback for each option,
It would work across different environment (desktop/mobile/other) that some option might be unavailable,
and also browsers can provide choice to users.
The opener's window type (tab/popup/web-application/etc.) may also influence the resulting window type or UI details (e.g. web-app popup in Chromium).
Yes, we should define a matrix for opener's window type and requested window type.
It may be detrimental to rigorously specify UI elements, dimensions, or characteristics.
Yes, IIUC, Firefox was the last modern browser that supported those UI-specific features separately, and the behavior was removed.
On the other hand, I'd personally like to see some advances and consistency in popup window design.
Thanks :)
Also, the consistent popup design will also benefit the WebExtension UI design,
about what tool (browser action, page action) to provide for popup.
I may be misreading this, but I think Chromium's IsPopup(windowFeature) should have a step after 5 like
6. If windowFeature["width"] is true or windowFeature["height"] is true, then:
1. Return true.
I don't see difference in the following 2 cases, that passes steps 1-5, and both don't result in popup:
I forgot to describe Firefox's case and my opinion:
the reasoning behind the current condition for popup/window/tab
Firefox has been allowing website to specify each UI parts' visibility separately until Firefox 76.
And we've changed the behavior to follow other browsers, website no more can specify each UI parts visibility.
The condition for popup/window/tab is based on:
the mix of other browsers' behavior about when to use popup
existing configuration about window vs tab
concern for changing/standardizing the condition
Given above, changing the condition for popup should be fine.
Changing condition for window/tab may affect users, but if we can provide fallback or some customizability, that should be fine.
As pointed out by @michaelwasserman, adding explicit feature would be nice,
instead of specifying combination of existing features (that's already confusing)
the reasoning behind the popup window's UI (why location bar is read-only or hidden, why toolbar etc are hidden)
About UI visibility, we chose minimal UI for popup, that is, only location bar is shown,
because that was the default behavior when any UI-visibility features aren't specified,
and that seems to be common usecase.
The other usecase was to specify all UI parts' features and open normal browser window, but that behavior was changed to open a new tab, to follow chromium's behavior, and also to honor user's configuration about where to open new window (tab vs window).
Location bar has made readonly in bug 22183 (commit) at the same time showing a minimal-location bar for the case standard location bar is hidden, in order to prevent spoofing.
At that point, IIUC, the minimal-location bar was only for informative purpose and not for navigation, to avoid breaking web, that's the reason why it's made readonly.
Apparently the minimal-location bar is made hide-able again for web-compat issue, and then it's made always visible in bug 337344 (commit), in order to make spoofing harder.
At this point, still it's considered to be informative, and that seems to be the reason why it's kept readonly.
concern for changing popup window's UI
Given that the current style is decided based on old behavior around UI (allows contolling each UI parts' visibility, and status bar had many items), we could revisit the UI.
Personally, location bar still feels necessary for anti-spoofing, so, I'd like to hear the reasoning behind Safari's behavior that hides location bar.
Adding more items (toolbar, tabs, etc) may benefit users, but adding them unconditionally may break the web content display on small screen.
There was some comments about making full toolbar switchable in above bugs, we could revisit it also.
@arai-a I don't think Safari's UI allows for spoofing as the domain is clearly visible in the chrome of the popup. If we are to keep (readonly) popups that actually seems like the most appropriate UI to me.
Here are some thoughts / commentary I've gathered from Safari/WebKit side so far:
Safari has a preference to "open pages in tabs instead of windows". This preference needs preside over whatever references website may give to window.open.
Safari's condition for when to use a popup changed over time. Notably, we've removed all but most ways for websites to signal to use a popup (it used to be same as what Chrome does today).
Safari's condition for when to use a popup changed over time. Notably, we've removed all but most ways for websites to signal to use a popup (it used to be same as what Chrome does today).
That's great news.
If there weren't much breakage with the change, it means that we can use Safari's condition, that's "open popup only when width is specified", as minimum condition, regardless of whether to add yet another explicit feature (e.g. type=popup) for where to open the page.
Then, #4431 also suggests that it's better just dropping all features that are directly/indirectly connected with BarProps.
Safari has a preference to "open pages in tabs instead of windows". This preference needs preside over whatever references website may give to window.open.
This sounds like good solution for people who wants toolbars always available.
"Never using popup" works around the issue that "toolbars aren't available in popup".
Maybe browser can provide "open new normal window instead" option as well, if necessary.
For WebExtensions' toolbar situation, I'll track it in separate issue, given that popup condition can be solved before that.
Currently it doesn't cover the detailed UI parts visibility for the popup (just requires location bar or equivalent for showing URL or domain),
and also the explicit features (type=popup) isn't yet integrated.
I choose "popup" vs "tab" (instead of "window"), because many modern desktop browsers provides tab features, and also looks like mobile browsers also calls each page "tab".
I choose "popup" vs "tab" (instead of "window"), because many modern desktop browsers provides tab features, and also looks like mobile browsers also calls each page "tab".
I don't think the distinction between "tab" and "window" makes much sense. That is squarely the concern of each web browser & underlying operating system. Some operating systems such as iOS doesn't even provide a concept of window.
Also, I'm not really sure that defining what kind of UI popup will have or will not have is something HTML spec should even mention. That is at best a non-normative note.
@arai-a thank you for writing that up! It's really great to see us make some progress in this area.
I agree with @rniwa that we probably want to abstract this a little bit. How about we give "top-level browsing context" a boolean "is popup" field and based on that we define the BarProp properties to return false. And then in notes we describe some of the possible UI choices.
Quick heads-up that the TAG reviewed this change, and was of the opinion that a type=popup type enum would have been more extensible than a boolean popup flag. I replied with some of the conversation that took place on the PR, but I thought I'd post a heads-up here, in case people think any action needs to be taken. This feature only shipped very recently, so there's likely still time to make changes if needed. But not for too long.
Also one more point the TAG made: it would have been (or would still be) nice to allow windowFeatures to be specified as a dictionary, with the new popup parameter possibly only available there, to encourage its use.
That does seem like a reasonable idea. I think for click attribution APIs they also want to add new parameters to window.open(). It would be a bit of design and testing work though and we wouldn't want to support just popup there, noopener and noreferrer also need to be supported in some fashion.
Activity
annevk commentedon Aug 31, 2020
@rniwa can you help with this or point to someone else from WebKit who can? @natechapin can you for Chromium perhaps?
michaelwasserman commentedon Sep 2, 2020
Thanks for investigating these topics and promoting cross-browser consistency! Here are some initial thoughts as a Chromium developer proposing semi-related Screen/Window changes/APIs (but limited web-platform experience):
the reasoning behind the current condition for popup/window/tab
Others might have historical perspective on conditions, but I suspect Chromium inherited Webkit behavior and made incremental changes over time to address specific cases; it may be difficult to capture that history, I hope other folks will chime in.
concern for changing/standardizing the condition
Standardizing popup/window/tab conditions seems desirable. Introducing a new explicit feature string parameter e.g. 'type=tab' could clarify intent of the request (for this poorly-shaped API). Considering the space of web application manifest display modes in tandem would be very nice. The opener's window type (tab/popup/web-application/etc.) may also influence the resulting window type or UI details (e.g. web-app popup in Chromium).
the reasoning behind the popup window's UI (why location bar is read-only or hidden, why toolbar etc are hidden)
I don't have historical perspective here, but each implementer would probably cite some overlapping set of reasons (e.g. they weren't primarily meant to be user-navigable surfaces; they're designed to minimize frame UI/dimensions and accompany a 'main' browser window; etc.). Chromium even has slightly different styling for popups from web application windows, which use the web application out-of-scope navigation info-bar in lieu of a read-only location bar :-/
concern for changing popup window's UI
It may be detrimental to rigorously specify UI elements, dimensions, or characteristics. While some window.open features were designed for ui specification (thank you for iterating on that documentation!), they've obviously fallen out of favor. On the other hand, I'd personally like to see some advances and consistency in popup window design.
I may be misreading this, but I think Chromium's IsPopup(windowFeature) should have a step after 5 like
arai-a commentedon Sep 3, 2020
Thank you.
Yeah, adding explicit feature string sounds better.
This looks nice, that it also defines fallback for each option,
It would work across different environment (desktop/mobile/other) that some option might be unavailable,
and also browsers can provide choice to users.
Yes, we should define a matrix for opener's window type and requested window type.
Thank you for the resource, it looks great.
Yes, IIUC, Firefox was the last modern browser that supported those UI-specific features separately, and the behavior was removed.
Thanks :)
Also, the consistent popup design will also benefit the WebExtension UI design,
about what tool (browser action, page action) to provide for popup.
I don't see difference in the following 2 cases, that passes steps 1-5, and both don't result in popup:
"location=yes,menubar=yes,resizable=yes,scrollbars=yes,status=yes,toolbar=yes""location=yes,menubar=yes,resizable=yes,scrollbars=yes,status=yes,toolbar=yes,width=500,height=500"arai-a commentedon Sep 3, 2020
I forgot to describe Firefox's case and my opinion:
Firefox has been allowing website to specify each UI parts' visibility separately until Firefox 76.
And we've changed the behavior to follow other browsers, website no more can specify each UI parts visibility.
The condition for popup/window/tab is based on:
Given above, changing the condition for popup should be fine.
Changing condition for window/tab may affect users, but if we can provide fallback or some customizability, that should be fine.
As pointed out by @michaelwasserman, adding explicit feature would be nice,
instead of specifying combination of existing features (that's already confusing)
About UI visibility, we chose minimal UI for popup, that is, only location bar is shown,
because that was the default behavior when any UI-visibility features aren't specified,
and that seems to be common usecase.
The other usecase was to specify all UI parts' features and open normal browser window, but that behavior was changed to open a new tab, to follow chromium's behavior, and also to honor user's configuration about where to open new window (tab vs window).
Location bar has made readonly in bug 22183 (commit) at the same time showing a minimal-location bar for the case standard location bar is hidden, in order to prevent spoofing.
At that point, IIUC, the minimal-location bar was only for informative purpose and not for navigation, to avoid breaking web, that's the reason why it's made readonly.
Apparently the minimal-location bar is made hide-able again for web-compat issue, and then it's made always visible in bug 337344 (commit), in order to make spoofing harder.
At this point, still it's considered to be informative, and that seems to be the reason why it's kept readonly.
Given that the current style is decided based on old behavior around UI (allows contolling each UI parts' visibility, and status bar had many items), we could revisit the UI.
Personally, location bar still feels necessary for anti-spoofing, so, I'd like to hear the reasoning behind Safari's behavior that hides location bar.
Adding more items (toolbar, tabs, etc) may benefit users, but adding them unconditionally may break the web content display on small screen.
There was some comments about making full toolbar switchable in above bugs, we could revisit it also.
annevk commentedon Sep 9, 2020
@arai-a I don't think Safari's UI allows for spoofing as the domain is clearly visible in the chrome of the popup. If we are to keep (readonly) popups that actually seems like the most appropriate UI to me.
arai-a commentedon Sep 9, 2020
Thank you for pointing that out :)
victornpb commentedon Sep 9, 2020
As said before, location should not be able to be hidden, as it would be easily abused for phishing, specially for creating fake oauth popups.
arai-a commentedon Sep 24, 2020
@rniwa can you take a look?
rniwa commentedon Mar 14, 2021
Here are some thoughts / commentary I've gathered from Safari/WebKit side so far:
window.open.arai-a commentedon Mar 17, 2021
Thank you!
That's great news.
If there weren't much breakage with the change, it means that we can use Safari's condition, that's "open popup only when
widthis specified", as minimum condition, regardless of whether to add yet another explicit feature (e.g.type=popup) for where to open the page.Then, #4431 also suggests that it's better just dropping all features that are directly/indirectly connected with
BarProps.This sounds like good solution for people who wants toolbars always available.
"Never using popup" works around the issue that "toolbars aren't available in popup".
Maybe browser can provide "open new normal window instead" option as well, if necessary.
For WebExtensions' toolbar situation, I'll track it in separate issue, given that popup condition can be solved before that.
I'll write a draft spec change.
arai-a commentedon Mar 23, 2021
Here's draft proposal, https://arai-a.github.io/window-open-features/proposal.html , that covers this issue and #4431 ,
based on Safari's behavior for window.open features parameter, and chrome's behavior for BarProps, and some extra steps for user-agent-dependent behavior for user-preference etc.
Currently it doesn't cover the detailed UI parts visibility for the popup (just requires location bar or equivalent for showing URL or domain),
and also the explicit features (
type=popup) isn't yet integrated.I choose "popup" vs "tab" (instead of "window"), because many modern desktop browsers provides tab features, and also looks like mobile browsers also calls each page "tab".
Suggestions welcome :)
rniwa commentedon Mar 23, 2021
I don't think the distinction between "tab" and "window" makes much sense. That is squarely the concern of each web browser & underlying operating system. Some operating systems such as iOS doesn't even provide a concept of window.
Also, I'm not really sure that defining what kind of UI popup will have or will not have is something HTML spec should even mention. That is at best a non-normative note.
annevk commentedon Mar 23, 2021
@arai-a thank you for writing that up! It's really great to see us make some progress in this area.
I agree with @rniwa that we probably want to abstract this a little bit. How about we give "top-level browsing context" a boolean "is popup" field and based on that we define the BarProp properties to return false. And then in notes we describe some of the possible UI choices.
63 remaining items
Change behavior of window.open w.r.t. windowPreferences and popups
Change behavior of window.open w.r.t. windowPreferences and popups
Change behavior of window.open w.r.t. windowPreferences and popups
Bug 1715886 [wpt PR 29334] - Change behavior of window.open w.r.t. wi…
Bug 1715886 [wpt PR 29334] - Change behavior of window.open w.r.t. wi…
Standardize window.open() popup features and BarProp values
mfreed7 commentedon Dec 14, 2021
Quick heads-up that the TAG reviewed this change, and was of the opinion that a
type=popuptype enum would have been more extensible than a booleanpopupflag. I replied with some of the conversation that took place on the PR, but I thought I'd post a heads-up here, in case people think any action needs to be taken. This feature only shipped very recently, so there's likely still time to make changes if needed. But not for too long.mfreed7 commentedon Dec 14, 2021
Also one more point the TAG made: it would have been (or would still be) nice to allow
windowFeaturesto be specified as a dictionary, with the newpopupparameter possibly only available there, to encourage its use.annevk commentedon Dec 14, 2021
That does seem like a reasonable idea. I think for click attribution APIs they also want to add new parameters to
window.open(). It would be a bit of design and testing work though and we wouldn't want to support justpopupthere,noopenerandnoreferreralso need to be supported in some fashion.domenic commentedon Dec 14, 2021
Here was my proposal for redesigning window.open() to be a modern dictionary-accepting API: WICG/attribution-reporting-api#130 (comment) . Last time @annevk wasn't a fan, but maybe he's changed his mind?
annevk commentedon Dec 14, 2021
I'm more open to it. Getting rid of popups isn't going to happen anytime soon and it's clear we might add more here over time.
Standardize window.open() popup features and BarProp values
Standardize window.open() popup features and BarProp values
Bug 1701008 [wpt PR 28243] - HTML: the condition for opening a popup …
Bug 1715886 [wpt PR 29334] - Change behavior of window.open w.r.t. wi…