Skip to content
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

Add additional feature names to window.open() #2464

Closed
foolip opened this issue Mar 24, 2017 · 17 comments
Closed

Add additional feature names to window.open() #2464

foolip opened this issue Mar 24, 2017 · 17 comments
Labels
interop Implementations are not interoperable with each other topic: browsing context topic: navigation

Comments

@foolip
Copy link
Member

foolip commented Mar 24, 2017

https://html.spec.whatwg.org/multipage/browsers.html#dom-open
https://drafts.csswg.org/cssom-view/#the-features-argument-to-the-open()-method

Together these define "left", "top", "width", "height" and "noopener". Blink also has:

  • "screenx" and "screeny" as aliases of "left" and "top"
  • "innerwidth" and "innerheight" as aliases of "width" and "height"
  • "menubar", "toolbar", "location", "status", "fullscreen" and "scrollbars"

There is a potential interop issue here, in https://codereview.chromium.org/2773573002/ tests were written for when a new window is opened vs. a new tab, and those tests don't pass everywhere.

@zetafunction

@annevk
Copy link
Member

annevk commented Mar 24, 2017

Shouldn't a browser be in a control over what it does with these to a large extent? We can't really dictate a windowing system as that has big UX implications.

@zetafunction
Copy link

I changed Chrome's behavior to match Firefox: the main UI difference between a popup and a tab is whether or not the toolbar is enabled. So this is now the only window feature we consult before determining how to style the new window.

Many of the other window features that Chrome used to check (resizable, menubar, status, scrollbars) are things that aren't configurable anymore: popups are always resizable, with no option of hiding the status bar, Chrome has no menubar, and scrollbars shouldn't affect whether or not the window should be styled as a popup.

I do think it'd be useful to specify the other window features; they're essentially a de facto standard, but not actually covered anywhere atm.

@zcorpan
Copy link
Member

zcorpan commented Mar 27, 2017

So to be clear, specifying toolbar=yes opens a popup with the toolbar; any non-empty feature argument without that will open a popup without the toolbar? And missing or empty feature argument opens a tab? (https://www.w3.org/Bugs/Public/show_bug.cgi?id=25685)

zcorpan added a commit to w3c/csswg-drafts that referenced this issue Mar 27, 2017
Add screenx, screeny, innerwidth, innerheight as aliases for left,
top, width, and height, respectively.

Part of whatwg/html#2464
@zcorpan
Copy link
Member

zcorpan commented Mar 27, 2017

PR for aliases at w3c/csswg-drafts#1128

zcorpan added a commit that referenced this issue Mar 27, 2017
This was specified in CSSOM View but the "noopener" feature did
not use the same tokenizer as the legacy features. Fixes #2474.

Also specify the aliases screenx, screeny, innerwidth, innerheight
for left, top, width, and height, respectively. Part of #2464.
Closes w3c/csswg-drafts#1128.
@zcorpan
Copy link
Member

zcorpan commented Mar 30, 2017

The new Chromium behavior introduced in https://codereview.chromium.org/2773573002 will open a new tab rather than a popup if the toolbar feature is enabled (or if features is the empty string). This is different from at least Firefox in that Firefox will open a new window (with the specified size/position) if toolbar is enabled (with address bar/back button etc). Firefox only opens a new tab if features is the empty string.

I tried to analyze the impact of this change in httparchive, see: https://bugs.chromium.org/p/chromium/issues/detail?id=82522#c113 - in some cases it seems unexpected but in other cases it seems like it would improve the user experience.

I wonder if other vendors would be willing to adopt the new Chromium behavior and open a new tab rather than a new window if toolbar is enabled (even if left/width etc are also specified)?

A benefit from doing that is that it is possible to open a new tab or a new window with the noopener feature; in Firefox this will always result in a new window.

cc @cdumez @jgraham @miketaylr

zcorpan added a commit that referenced this issue Apr 5, 2017
This was specified in CSSOM View but the "noopener" feature did
not use the same tokenizer as the legacy features. Fixes #2474.

Also specify the aliases screenx, screeny, innerwidth, innerheight
for left, top, width, and height, respectively. Part of #2464.
Closes w3c/csswg-drafts#1128.

The tokenizer specified here closely follows Chromium and WebKit.
Difference from Chromium: U+0000 is not a separator.
Difference from WebKit and Chromium: U+000C is a separator.
zcorpan added a commit that referenced this issue Apr 6, 2017
This was specified in CSSOM View but the "noopener" feature did
not use the same tokenizer as the legacy features. Fixes #2474.

Also specify the aliases screenx, screeny, innerwidth, innerheight
for left, top, width, and height, respectively. Part of #2464.
Closes w3c/csswg-drafts#1128.

The tokenizer specified here closely follows Edge.
Chromium and WebKit are also very similar to Edge.
Difference from Edge: U+0000 does not end the string.
Difference from Chromium: U+0000 is not a separator.
Difference from WebKit/Chromium/Edge: U+000C is a separator.

For the input `width toolbar=450, height=450`,
Edge tokenizes like `width, toolbar=450, height=450` while
WebKit/Chromium like `width=450, height=450`.
The Edge behavior seems better.

Tests:
web-platform-tests/wpt#5306
web-platform-tests/wpt#5390
@smaug----
Copy link

smaug---- commented Apr 12, 2017

Sounds a bit hackish, especially the part to use toolbar to overcome limitations of noopener.
Why toolbar is special?
How does one then open a new window with toolbar and all? (whatever toolbar means these days, but the more complicated UI)

@smaug----
Copy link

What does Chrome do if you first open a new window (no toolbars) and then open a new window from that with 'toolbar' ?

@zcorpan
Copy link
Member

zcorpan commented Apr 12, 2017

Discussion in #whatwg http://logs.glob.uno/?c=freenode%23whatwg&s=12+Apr+2017&e=12+Apr+2017#c1025657

<zcorpan> smaug: do you have any opinion ? github.com//issues/2464#issuecomment-290421056
<smaug> zcorpan: using toolbar for the noopener case feels like a hack
<zcorpan> smaug: i guess. maybe noopener should have been specified in a new argument with a dictionary, but now it's implemented as a "feature"
<smaug> zcorpan: why is toolbar special?
<smaug> I would expect a new window with toolbar to be shown
<zcorpan> smaug: because it's special in firefox (it opens a "full" browser window rather than a minimal-chrome window)
<smaug> yes, sounds like FF's behavior is the expected one
<smaug> zcorpan: how does one then open a new proper window with toolbar and all?
<zcorpan> smaug: ok. in non-firefox browsers that is not possible
<zcorpan> smaug: before the recent change in chromium you'd always get a minimal-chrome popup
<zcorpan> smaug: in safari/chrome/opera/edge
<smaug> what does Edge do?
<zcorpan> smaug: and empty or missing features argument opens a tab (but then you can't use noopener if you want a tab)
<smaug> er, you said edge
<zcorpan> right
<zcorpan> edge also doesn't support noopener here
<zcorpan> afaik (maybe changed in edge15)
<smaug> I might like more some new value
<smaug> which actually tells to the API user what is probably happening
<smaug> zcorpan: does just having 'toolbar' open a tab, even with any other features like size?
<zcorpan> smaug: yes
<smaug> confusing
<zcorpan> smaug: thanks for the feedback. could you also clarify what you would like to see instead?
<smaug> zcorpan: so for API users, shouldn't it be something like openInTab
<smaug> new feature
<smaug> zcorpan: what does Chrome do if you first open a new window (no toolbars) and then open a new window with 'toolbar' ?
<zcorpan> smaug: note that all browsers already have ability to open in a new tab from window.open - http://software.hixie.ch/utilities/js/live-dom-viewer/saved/5007
<smaug> sure
<smaug> I'm not talking about that
<zcorpan> smaug: it first opens a popup and then a tab... http://software.hixie.ch/utilities/js/live-dom-viewer/saved/5008
<smaug> zcorpan: you're opening from the same window
<smaug> first open without toolbar, and then that one opens with toolbar
<zcorpan> oh, i see
<zcorpan> smaug: http://software.hixie.ch/utilities/js/live-dom-viewer/saved/5009 it opens a tab in the first window
<smaug> huh
<smaug> ok, I didn't know blink has this weird behavior
<zcorpan> it's pretty new and hasn't shipped yet
<zcorpan> CL https://codereview.chromium.org/2773573002
<smaug> but why does it open a tab in an existing window

@zetafunction
Copy link

It's because Chrome always current prefers to open a new foreground tab when toolbar=1. I think this always prefers to reuse an existing window if one exists.

It should be pretty easy to change this to prefer opening a new window when called from a popup, if people feel that is the correct behavior.

@zcorpan
Copy link
Member

zcorpan commented Apr 13, 2017

@zetafunction such a new window would then not be a full browser window, but a minimal-chrome popup, correct?

@zcorpan
Copy link
Member

zcorpan commented Apr 13, 2017

For the case of following a hyperlink with target=_blank inside a popup, both Chrome and Firefox will open a new tab in the original window, while Safari will open a new full browser window.

http://software.hixie.ch/utilities/js/live-dom-viewer/saved/5017

Also, window.open with an empty features argument has the same behavior.

http://software.hixie.ch/utilities/js/live-dom-viewer/saved/5018

@smaug---- do you think Chrome and Firefox should change their behavior for these?

@zetafunction
Copy link

@zcorpan Why should opening a toolbar=1 window from a popup window imply creating another popup window? This effectively means the toolbar feature has no effect once you're in a popup window, right?

@zcorpan
Copy link
Member

zcorpan commented Apr 14, 2017

I'm just trying to get clarified what y'all want to end up with. 😊 I thought maybe there was some reason to avoid opening a new full window...

@kkruups
Copy link

kkruups commented Apr 26, 2017

@zcorpan

The expected behavior should be a new PopUp Window when size dimensions are passed as arguments to window.open (if toolbar is enabled, then add the toolbar to the PopUp window). If no dimensions are indicated just default to opening a new tab (in this case toolbar enabled is the default).
(Btw, this is FF current Behavior (version 54.0a2)) .

Chrome Behavior (Canary 60.0.3079.0)

Opens PopUp Window to indicated dimensions
window.open("https://google.com","foo","width=800, height=780")

Opens New Tab (browsers default minimized size, ignores size dimensions)
window.open("https://google.com","foo","width=800, height=780,toolbar=1")

FF Behavior

w/Size Dimensions
Opens PopUp Window w/o ToolBar (NO toolbar)
window.open("https://google.com","foo","width=800, height=780")

Opens PopUp with ToolBar
window.open("https://google.com","foo","width=800, height=780, toolbar=1")

w/o size dimensions
Opens New Tab
window.open("https://google.com","foo")
window.open("https://google.com","foo", "toolbar=1")

inikulin pushed a commit to HTMLParseErrorWG/html that referenced this issue May 9, 2017
This was specified in CSSOM View but the "noopener" feature did
not use the same tokenizer as the legacy features. Fixes whatwg#2474.

Also specify the aliases screenx, screeny, innerwidth, innerheight
for left, top, width, and height, respectively. Part of whatwg#2464.
Closes w3c/csswg-drafts#1128.

The tokenizer specified here closely follows Edge.
Chromium and WebKit are also very similar to Edge.
Difference from Edge: U+0000 does not end the string.
Difference from Chromium: U+0000 is not a separator.
Difference from WebKit/Chromium/Edge: U+000C is a separator.

For the input `width toolbar=450, height=450`,
Edge tokenizes like `width, toolbar=450, height=450` while
WebKit/Chromium like `width=450, height=450`.
The Edge behavior seems better.

Tests:
web-platform-tests/wpt#5306
web-platform-tests/wpt#5390
inikulin pushed a commit to HTMLParseErrorWG/html that referenced this issue May 9, 2017
This was specified in CSSOM View but the "noopener" feature did
not use the same tokenizer as the legacy features. Fixes whatwg#2474.

Also specify the aliases screenx, screeny, innerwidth, innerheight
for left, top, width, and height, respectively. Part of whatwg#2464.
Closes w3c/csswg-drafts#1128.

The tokenizer specified here closely follows Edge.
Chromium and WebKit are also very similar to Edge.
Difference from Edge: U+0000 does not end the string.
Difference from Chromium: U+0000 is not a separator.
Difference from WebKit/Chromium/Edge: U+000C is a separator.

For the input `width toolbar=450, height=450`,
Edge tokenizes like `width, toolbar=450, height=450` while
WebKit/Chromium like `width=450, height=450`.
The Edge behavior seems better.

Tests:
web-platform-tests/wpt#5306
web-platform-tests/wpt#5390
@annevk annevk added interop Implementations are not interoperable with each other topic: browsing context topic: navigation labels Oct 9, 2017
alice pushed a commit to alice/html that referenced this issue Jan 8, 2019
This was specified in CSSOM View but the "noopener" feature did
not use the same tokenizer as the legacy features. Fixes whatwg#2474.

Also specify the aliases screenx, screeny, innerwidth, innerheight
for left, top, width, and height, respectively. Part of whatwg#2464.
Closes w3c/csswg-drafts#1128.

The tokenizer specified here closely follows Edge.
Chromium and WebKit are also very similar to Edge.
Difference from Edge: U+0000 does not end the string.
Difference from Chromium: U+0000 is not a separator.
Difference from WebKit/Chromium/Edge: U+000C is a separator.

For the input `width toolbar=450, height=450`,
Edge tokenizes like `width, toolbar=450, height=450` while
WebKit/Chromium like `width=450, height=450`.
The Edge behavior seems better.

Tests:
web-platform-tests/wpt#5306
web-platform-tests/wpt#5390
@annevk
Copy link
Member

annevk commented May 3, 2019

Now that HTML defines a bunch of normalization, to what extent is this still an HTML issue and not a CSSOM issue?

@annevk
Copy link
Member

annevk commented Oct 17, 2019

This observation from bz at #1902 (comment) is also important:

Wouldn't CSSOM ignore unknown tokens anyway?

That doesn't match actual browser behavior (again in at least Firefox and Chrome). If I do:

window.open("", "", "yousaywhat?");

I get a browser window missing UI pieces in both.

I filed w3c/csswg-drafts#4432 to figure out how to split these between CSSOM and HTML. Perhaps all of it ought to move here given the BarProp implications, or we move all of that there too.

@domenic
Copy link
Member

domenic commented Mar 4, 2022

This was fixed by ab08b9b.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interop Implementations are not interoperable with each other topic: browsing context topic: navigation
Development

No branches or pull requests

7 participants