-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Standardize a popup's condition and UI opened by window.open #5872
Comments
@rniwa can you help with this or point to someone else from WebKit who can? @natechapin can you for Chromium perhaps? |
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):
I may be misreading this, but I think Chromium's IsPopup(windowFeature) should have a step after 5 like
|
Thank you.
Yeah, adding explicit feature string sounds better.
This looks nice, that it also defines fallback for each option,
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 :)
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:
Firefox has been allowing website to specify each UI parts' visibility separately until Firefox 76. The condition for popup/window/tab is based on:
Given above, changing the condition for popup should be fine. As pointed out by @michaelwasserman, adding explicit feature would be nice,
About UI visibility, we chose minimal UI for popup, that is, only location bar is shown, 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. 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.
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. Adding more items (toolbar, tabs, etc) may benefit users, but adding them unconditionally may break the web content display on small screen. |
@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. |
Thank you for pointing that out :) |
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. |
@rniwa can you take a look? |
Here are some thoughts / commentary I've gathered from Safari/WebKit side so far:
|
Thank you!
That's great news. Then, #4431 also suggests that it's better just dropping all features that are directly/indirectly connected with
This sounds like good solution for people who wants toolbars always available. 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. |
Here's draft proposal, https://arai-a.github.io/window-open-features/proposal.html , that covers this issue and #4431 , Currently it doesn't cover the detailed UI parts visibility for the popup (just requires location bar or equivalent for showing URL or domain), 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 :) |
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. |
Thank you :)
I agree that the normative steps in the proposal shouldn't mention implementation dependent thing like "browser window".
Okay, I'll fix that part as well. |
That sounds good! |
Updated the proposal not to mention browser window or tab. |
Thanks @arai-a! I think this is ready for a pull request. Are you willing to create one? I'll be out for two weeks, but hopefully @domenic can help move it along, but if not I'll be happy to help once back. Quick comment on "Modify create a new browsing context", I think instead of this we can give is popup a default value of false. And in "IsPopupRequested" I don't think we need step 1 at which point we might as well inline this into the caller. |
Thank you!
Does it mean that we check the existence of
Indeed, the existence of the step doesn't change the condition, now that other features are removed. |
Sure, I'll open PR. |
Abstractly, it means that top-level browsing context has an is popup member that's false unless otherwise stated (the choosing a browsing context steps will set it to true sometimes). |
Thanks. I didn't know that "member" is different thing than internal slot. |
Fixes whatwg#5872 Define an "is popup" member in top-level browsing context, and set it to true only when the browsing context is created by calling `window.open` with `width` features provided. Also add non-normative notes/example for using popup UI depending on "is popup" member.
…alues for each case For whatwg/html#5872 and whatwg/html#4431
Fixes whatwg#5872 Define an "is popup" member in top-level browsing context, and set it to true only when the browsing context is created by calling `window.open` with `width` features provided. Also add non-normative notes/example for using popup UI depending on "is popup" member.
Fixes whatwg#5872 Define an "is popup" member in top-level browsing context, and set it to true only when the browsing context is created by calling `window.open` with specific combination of `features` parameter. Also add non-normative notes/example for using popup UI depending on "is popup" member.
…alues for each case For whatwg/html#5872 and whatwg/html#4431
…alues for each case For whatwg/html#5872 and whatwg/html#4431
Fixes whatwg#5872 Define an "is popup" member in top-level browsing context, and set it to true only when the browsing context is created by calling `window.open` with specific combination of `features` parameter. Also add non-normative notes/example for using popup UI depending on "is popup" member.
…by window.open, and BarProp values for each case, a=testonly Automatic update from web-platform-tests HTML: test BarProp and window.open() feature interactions For whatwg/html#5872, whatwg/html#4431, and whatwg/html#6530. -- wpt-commits: 29faceaa68f5cb31798cc17fe6868eaf5fa5fb7f wpt-pr: 28243
…by window.open, and BarProp values for each case, a=testonly Automatic update from web-platform-tests HTML: test BarProp and window.open() feature interactions For whatwg/html#5872, whatwg/html#4431, and whatwg/html#6530. -- wpt-commits: 29faceaa68f5cb31798cc17fe6868eaf5fa5fb7f wpt-pr: 28243
See [1] and [2] for more context, but this CL implements new behavior for how window.open() interprets the windowPreferences argument when deciding whether to open the window as a new tab or as a "popup", which is a separate window with minimal UI (toolbars, onmibox, etc.), and also what to return from the BarProp visible properties, e.g. window.toolbar.visible. The existing "trigger" behavior for popups will be retained by this CL, namely that a popup will be opened instead of a tab if: 1. the windowFeatures parameter is *not* empty, and 2. one of the following conditions is true: * both `location` and `toolbar` are false or missing * `menubar` is false or missing * `resizable is false or missing * `scrollbar` is false or missing * `status` is false or missing With this CL, an additional windowFeature called 'popup' is added, so that if 'popup' is present and truthy. Additionally, all BarProp properties (locationbar,menubar, personalbar,scrollbars,statusbar, and toolbar) will always return the same values, either false if a popup was opened, or true if a tab/window was opened. The spec for this behavior is part of the HTML spec: https://html.spec.whatwg.org/multipage/window-object.html#popup-window-is-requested The intent to ship is here: https://groups.google.com/a/chromium.org/g/blink-dev/c/q6ybnmxxvpE [1] whatwg/html#5872 [2] whatwg/html#6530 Fixed: 1192701 Change-Id: I50e745b1000d460c49085edd57d13f420b875ff3
See [1] and [2] for more context, but this CL implements new behavior for how window.open() interprets the windowPreferences argument when deciding whether to open the window as a new tab or as a "popup", which is a separate window with minimal UI (toolbars, onmibox, etc.), and also what to return from the BarProp visible properties, e.g. window.toolbar.visible. The existing "trigger" behavior for popups will be retained by this CL, namely that a popup will be opened instead of a tab if: 1. the windowFeatures parameter is *not* empty, and 2. one of the following conditions is true: * both `location` and `toolbar` are false or missing * `menubar` is false or missing * `resizable is false or missing * `scrollbar` is false or missing * `status` is false or missing With this CL, an additional windowFeature called 'popup' is added, so that if 'popup' is present and truthy. Additionally, all BarProp properties (locationbar,menubar, personalbar,scrollbars,statusbar, and toolbar) will always return the same values, either false if a popup was opened, or true if a tab/window was opened. The spec for this behavior is part of the HTML spec: https://html.spec.whatwg.org/multipage/window-object.html#popup-window-is-requested The intent to ship is here: https://groups.google.com/a/chromium.org/g/blink-dev/c/q6ybnmxxvpE [1] whatwg/html#5872 [2] whatwg/html#6530 Fixed: 1192701 Change-Id: I50e745b1000d460c49085edd57d13f420b875ff3 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2950386 Reviewed-by: Joey Arhar <jarhar@chromium.org> Commit-Queue: Mason Freed <masonf@chromium.org> Cr-Commit-Position: refs/heads/main@{#943716}
See [1] and [2] for more context, but this CL implements new behavior for how window.open() interprets the windowPreferences argument when deciding whether to open the window as a new tab or as a "popup", which is a separate window with minimal UI (toolbars, onmibox, etc.), and also what to return from the BarProp visible properties, e.g. window.toolbar.visible. The existing "trigger" behavior for popups will be retained by this CL, namely that a popup will be opened instead of a tab if: 1. the windowFeatures parameter is *not* empty, and 2. one of the following conditions is true: * both `location` and `toolbar` are false or missing * `menubar` is false or missing * `resizable is false or missing * `scrollbar` is false or missing * `status` is false or missing With this CL, an additional windowFeature called 'popup' is added, so that if 'popup' is present and truthy. Additionally, all BarProp properties (locationbar,menubar, personalbar,scrollbars,statusbar, and toolbar) will always return the same values, either false if a popup was opened, or true if a tab/window was opened. The spec for this behavior is part of the HTML spec: https://html.spec.whatwg.org/multipage/window-object.html#popup-window-is-requested The intent to ship is here: https://groups.google.com/a/chromium.org/g/blink-dev/c/q6ybnmxxvpE [1] whatwg/html#5872 [2] whatwg/html#6530 Fixed: 1192701 Change-Id: I50e745b1000d460c49085edd57d13f420b875ff3 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2950386 Reviewed-by: Joey Arhar <jarhar@chromium.org> Commit-Queue: Mason Freed <masonf@chromium.org> Cr-Commit-Position: refs/heads/main@{#943716}
See [1] and [2] for more context, but this CL implements new behavior for how window.open() interprets the windowPreferences argument when deciding whether to open the window as a new tab or as a "popup", which is a separate window with minimal UI (toolbars, onmibox, etc.), and also what to return from the BarProp visible properties, e.g. window.toolbar.visible. The existing "trigger" behavior for popups will be retained by this CL, namely that a popup will be opened instead of a tab if: 1. the windowFeatures parameter is *not* empty, and 2. one of the following conditions is true: * both `location` and `toolbar` are false or missing * `menubar` is false or missing * `resizable is false or missing * `scrollbar` is false or missing * `status` is false or missing With this CL, an additional windowFeature called 'popup' is added, so that if 'popup' is present and truthy. Additionally, all BarProp properties (locationbar,menubar, personalbar,scrollbars,statusbar, and toolbar) will always return the same values, either false if a popup was opened, or true if a tab/window was opened. The spec for this behavior is part of the HTML spec: https://html.spec.whatwg.org/multipage/window-object.html#popup-window-is-requested The intent to ship is here: https://groups.google.com/a/chromium.org/g/blink-dev/c/q6ybnmxxvpE [1] whatwg/html#5872 [2] whatwg/html#6530 Fixed: 1192701 Change-Id: I50e745b1000d460c49085edd57d13f420b875ff3 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2950386 Reviewed-by: Joey Arhar <jarhar@chromium.org> Commit-Queue: Mason Freed <masonf@chromium.org> Cr-Commit-Position: refs/heads/main@{#943716}
…ndowPreferences and popups, a=testonly Automatic update from web-platform-tests Change behavior of window.open w.r.t. windowPreferences and popups See [1] and [2] for more context, but this CL implements new behavior for how window.open() interprets the windowPreferences argument when deciding whether to open the window as a new tab or as a "popup", which is a separate window with minimal UI (toolbars, onmibox, etc.), and also what to return from the BarProp visible properties, e.g. window.toolbar.visible. The existing "trigger" behavior for popups will be retained by this CL, namely that a popup will be opened instead of a tab if: 1. the windowFeatures parameter is *not* empty, and 2. one of the following conditions is true: * both `location` and `toolbar` are false or missing * `menubar` is false or missing * `resizable is false or missing * `scrollbar` is false or missing * `status` is false or missing With this CL, an additional windowFeature called 'popup' is added, so that if 'popup' is present and truthy. Additionally, all BarProp properties (locationbar,menubar, personalbar,scrollbars,statusbar, and toolbar) will always return the same values, either false if a popup was opened, or true if a tab/window was opened. The spec for this behavior is part of the HTML spec: https://html.spec.whatwg.org/multipage/window-object.html#popup-window-is-requested The intent to ship is here: https://groups.google.com/a/chromium.org/g/blink-dev/c/q6ybnmxxvpE [1] whatwg/html#5872 [2] whatwg/html#6530 Fixed: 1192701 Change-Id: I50e745b1000d460c49085edd57d13f420b875ff3 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2950386 Reviewed-by: Joey Arhar <jarhar@chromium.org> Commit-Queue: Mason Freed <masonf@chromium.org> Cr-Commit-Position: refs/heads/main@{#943716} -- wpt-commits: 3660b77d3cec8138401c12e055bee44d62e9b060 wpt-pr: 29334
…ndowPreferences and popups, a=testonly Automatic update from web-platform-tests Change behavior of window.open w.r.t. windowPreferences and popups See [1] and [2] for more context, but this CL implements new behavior for how window.open() interprets the windowPreferences argument when deciding whether to open the window as a new tab or as a "popup", which is a separate window with minimal UI (toolbars, onmibox, etc.), and also what to return from the BarProp visible properties, e.g. window.toolbar.visible. The existing "trigger" behavior for popups will be retained by this CL, namely that a popup will be opened instead of a tab if: 1. the windowFeatures parameter is *not* empty, and 2. one of the following conditions is true: * both `location` and `toolbar` are false or missing * `menubar` is false or missing * `resizable is false or missing * `scrollbar` is false or missing * `status` is false or missing With this CL, an additional windowFeature called 'popup' is added, so that if 'popup' is present and truthy. Additionally, all BarProp properties (locationbar,menubar, personalbar,scrollbars,statusbar, and toolbar) will always return the same values, either false if a popup was opened, or true if a tab/window was opened. The spec for this behavior is part of the HTML spec: https://html.spec.whatwg.org/multipage/window-object.html#popup-window-is-requested The intent to ship is here: https://groups.google.com/a/chromium.org/g/blink-dev/c/q6ybnmxxvpE [1] whatwg/html#5872 [2] whatwg/html#6530 Fixed: 1192701 Change-Id: I50e745b1000d460c49085edd57d13f420b875ff3 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2950386 Reviewed-by: Joey Arhar <jarhar@chromium.org> Commit-Queue: Mason Freed <masonf@chromium.org> Cr-Commit-Position: refs/heads/main@{#943716} -- wpt-commits: 3660b77d3cec8138401c12e055bee44d62e9b060 wpt-pr: 29334
Fixes whatwg#5872 by standardizing an internal "is popup" boolean, and how it is impacted by various window.open() features. Implementations can use this boolean (in addition to other signals) to determine whether an opened window is a popup or not. Fixes whatwg#4431 by changing the various BarProp visible properties to only reflect this "is popup" boolean, instead of reflecting the actual state of user interface elements, or the passed-in window features. Adds a "popup" window.open() feature to provide a simpler method of requesting a popup.
Quick heads-up that the TAG reviewed this change, and was of the opinion that a |
Also one more point the TAG made: it would have been (or would still be) nice to allow |
That does seem like a reasonable idea. I think for click attribution APIs they also want to add new parameters to |
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? |
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. |
Fixes whatwg#5872 by standardizing an internal "is popup" boolean, and how it is impacted by various window.open() features. Implementations can use this boolean (in addition to other signals) to determine whether an opened window is a popup or not. Fixes whatwg#4431 by changing the various BarProp visible properties to only reflect this "is popup" boolean, instead of reflecting the actual state of user interface elements, or the passed-in window features. Adds a "popup" window.open() feature to provide a simpler method of requesting a popup.
See [1] and [2] for more context, but this CL implements new behavior for how window.open() interprets the windowPreferences argument when deciding whether to open the window as a new tab or as a "popup", which is a separate window with minimal UI (toolbars, onmibox, etc.), and also what to return from the BarProp visible properties, e.g. window.toolbar.visible. The existing "trigger" behavior for popups will be retained by this CL, namely that a popup will be opened instead of a tab if: 1. the windowFeatures parameter is *not* empty, and 2. one of the following conditions is true: * both `location` and `toolbar` are false or missing * `menubar` is false or missing * `resizable is false or missing * `scrollbar` is false or missing * `status` is false or missing With this CL, an additional windowFeature called 'popup' is added, so that if 'popup' is present and truthy. Additionally, all BarProp properties (locationbar,menubar, personalbar,scrollbars,statusbar, and toolbar) will always return the same values, either false if a popup was opened, or true if a tab/window was opened. The spec for this behavior is part of the HTML spec: https://html.spec.whatwg.org/multipage/window-object.html#popup-window-is-requested The intent to ship is here: https://groups.google.com/a/chromium.org/g/blink-dev/c/q6ybnmxxvpE [1] whatwg/html#5872 [2] whatwg/html#6530 Fixed: 1192701 Change-Id: I50e745b1000d460c49085edd57d13f420b875ff3 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2950386 Reviewed-by: Joey Arhar <jarhar@chromium.org> Commit-Queue: Mason Freed <masonf@chromium.org> Cr-Commit-Position: refs/heads/main@{#943716} NOKEYCHECK=True GitOrigin-RevId: cdad240f282dca85fb85fa3ecc809d7f34862996
derived from arai-a/window-open-features#2 and https://bugzilla.mozilla.org/show_bug.cgi?id=1657738
The behavior of window.open differs between browsers, for:
features
parameter, fromcurrent situation is summarized in https://arai-a.github.io/window-open-features/ (let me know if you find something wrong there)
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 ofwindow.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:
related discussion:
The text was updated successfully, but these errors were encountered: