Skip to content

Standardize a popup's condition and UI opened by window.open #5872

Closed

Description

@arai-a

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:

  • the condition to choose the target based on features parameter, from
    • new popup window
    • new normal window
    • new tab
  • a popup window's UI (especially, whether to show location bar)

current 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 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:

  1. the reasoning behind the current condition for popup/window/tab
  2. concern for changing/standardizing the condition
  3. the reasoning behind the popup window's UI (why location bar is read-only or hidden, why toolbar etc are hidden)
  4. concern for changing popup window's UI

related discussion:

Activity

  1. annevk commented on Aug 31, 2020

    @annevk
    Member

    @rniwa can you help with this or point to someone else from WebKit who can? @natechapin can you for Chromium perhaps?

  2. added
    interop
    topic: frames/navigables/browsing contexts
    on Aug 31, 2020
  3. michaelwasserman commented on Sep 2, 2020

    @michaelwasserman

    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):

    1. 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.

    2. 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).

    3. 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 :-/

    4. 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.

    current situation is summarized in https://arai-a.github.io/window-open-features/ (let me know if you find something wrong there)

    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.
    
  4. arai-a commented on Sep 3, 2020

    @arai-a
    ContributorAuthor

    Thank you.

    Introducing a new explicit feature string parameter e.g. 'type=tab' could clarify intent of the request (for this poorly-shaped API).

    Yeah, adding explicit feature string sounds better.

    Considering the space of web application manifest display modes in tandem would be very nice.

    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.

    Thank you for the resource, it looks great.

    While some window.open features were designed for ui specification (thank you for iterating on that documentation!), they've obviously fallen out of favor.

    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:

    • "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"
  5. arai-a commented on Sep 3, 2020

    @arai-a
    ContributorAuthor

    I forgot to describe Firefox's case and my opinion:

    1. 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
    1. 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)

    1. 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.

    1. 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.

  6. annevk commented on Sep 9, 2020

    @annevk
    Member

    @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.

  7. arai-a commented on Sep 9, 2020

    @arai-a
    ContributorAuthor

    @arai-a I don't think Safari's UI allows for spoofing as the domain is clearly visible in the chrome of the popup.

    Thank you for pointing that out :)

  8. victornpb commented on Sep 9, 2020

    @victornpb

    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.

  9. arai-a commented on Sep 24, 2020

    @arai-a
    ContributorAuthor

    @rniwa can you take a look?

  10. rniwa commented on Mar 14, 2021

    @rniwa

    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).
  11. arai-a commented on Mar 17, 2021

    @arai-a
    ContributorAuthor

    Thank you!

    • 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.

    I'll write a draft spec change.

  12. arai-a commented on Mar 23, 2021

    @arai-a
    ContributorAuthor

    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 :)

  13. rniwa commented on Mar 23, 2021

    @rniwa

    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.

  14. annevk commented on Mar 23, 2021

    @annevk
    Member

    @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.

  15. 63 remaining items

  16. added a commit that references this issue on Dec 4, 2021
    e0361c0
  17. mfreed7 commented on Dec 14, 2021

    @mfreed7
    Contributor

    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.

  18. mfreed7 commented on Dec 14, 2021

    @mfreed7
    Contributor

    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.

  19. annevk commented on Dec 14, 2021

    @annevk
    Member

    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.

  20. domenic commented on Dec 14, 2021

    @domenic
    Member

    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?

  21. annevk commented on Dec 14, 2021

    @annevk
    Member

    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.

  22. added a commit that references this issue on Jun 3, 2022
    cc659e1
  23. added a commit that references this issue on Feb 2, 2024
    ab08b9b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    interoptopic: frames/navigables/browsing contexts

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions