#691: "FYI" Review of new window.open() behavior
Discussions
2021-12-Madripoor
Draft comment
@plinss and I took a look at this during our virtual f2f today.
We think that a boolean argument (popup=0
or popup=1
) is not extensible, if in the future authors want to select
between more than these two kinds of window UI, whereas a keyword-based argument (e.g. type=popup
)
would not have this problem.
As a side point, this sentence in the explainer was unclear:
The window.open() API is currently confusing to use, in terms of trying to get it to open a popup vs. a tab/window.
until I read this section on MDN:
Most modern browsers (listed below) don't allow web content to control the visibility of UI parts separately. [snip] UI-related items of
windowFeatures
are used as a condition to whether opening a popup or a new tab, or a new window, and UI parts visibility of each of them is fixed.
Furthermore, we understand that this method has a long history, but if it were designed today we would strongly recommend using a dictionary instead of a serialized string that has to be parsed and re-serialized, see: https://github.com/w3ctag/design-principles/issues/213. It may be worth considering allowing users to pass a dictionary in place of this string for future enchancements, similarly to what was done for addEventListener()
.
We generally encourage people to seek feedback before features have already shipped in browsers. Given that this has already shipped in both Blink and Gecko, it seems too late to have any of our feedback taken on board. Therefore we're closing this issue, feel free to ping us if there's anything further to discuss.
OpenedNov 19, 2021
Braw mornin' TAG!
I'm requesting a TAG review of the newly-specified window.open() behavior.
Per my Chromium Intent to Ship, it was requested that I file an FYI TAG review - hence this request.
Here is a summary of the changes, copied from the chromestatus entry for this change:
The window.open() API is currently confusing to use, in terms of trying to get it to open a popup vs. a tab/window. This change simplifies the usage by adding a single boolean argument called 'popup' that works as you'd expect: popup=1 gets you a popup, and popup=0 gets a tab/window:
const popup = window.open('_blank','','popup=1'); const tab = window.open('_blank','','popup=0');
Also there were previously confusingly-behaved getters for the BarProp visible properties (e.g. window.statusbar.visible) which didn't correctly represent what was actually visible. Now, those all return true if you got a new window/tab, and false if you got a popup.
This is an interop-driven change, to align Chromium with the newly-landed spec for window.open. It does not change existing behavior around whether a popup or tab/window is opened, to avoid compat issues.
Further details:
We'd prefer the TAG provide feedback as (please delete all but the desired option):
💬 leave review feedback as a comment in this issue and @-notify @mfreed7