-
Notifications
You must be signed in to change notification settings - Fork 23.1k
Window.open() complete overhaul #12425
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
Conversation
Preview URLsFlawsNone! 🎉 External URLsURL:
(this comment was updated 2022-03-21 20:32:03.709636) |
Co-authored-by: Joe Medley <[email protected]>
Co-authored-by: Joe Medley <[email protected]>
|
@dylandog95 Thank you for your patience and perseverance in this PR. Updates to old material are always like pulling teeth. |
Restored best practices, FAQ and notes sections for later consideration through a new issue. Retained the removal of the tutorials and references sections since links were broken and the tutorials were painfully out of date. (not sure if I restored this correctly, so forgive my naivety if I didn't)
|
@jpmedley You're very welcome. This has been a great learning opportunity for me, so I am thankful for your patience as well! |
|
@jpmedley I think I have addressed all requested changes here. Is there anything else you need to me to do to resolve this PR? Thanks |
|
@dylandog95 sorry for the delay. I thought we had decided to restore the removed content. It looks like it's still there. |
|
@jpmedley I think there is a misunderstanding or I did something wrong in adding back the latter sections. I merged back the Best Practices, FAQ, Usability Issues, Glossary, and Notes sections while retaining the rewrites that we decided were good to Summary, Syntax, Examples, and Window Features. Looking at the preview, it appears my committed changes did take effect. |
I think perhaps one thing that's confusing is that in his review, Joe asked for the window features UI bits, like But also, I think we (the MDN review crew) are not being very consistent in how we want to approach this work, and I'm sorry that this is giving you conflicting signals. IMO, as I said in https://github.com/mdn/content/pull/12425/files#r793284703, we should remove the UI features, because they're no longer supported anywhere. And I think you are handling this correctly in this PR, listing the window features values that are still useful and saying that other values (like the UI features ones) are now just a signal to use a popup. If the consensus is against this I'm happy to keep this stuff, but I'd like to be explicit about this decision. @teoli2003 , @ddbeck , @Elchi3 , opinions? I also think we should reorganize other sections of this document. It's a mess structurally: we should IMO take "Best practices", "FAQ", "Usability issues", "Glossary", and "Notes", update them and reorganize them as a single "Description" section. But perhaps we should do this in a follow-up PR, so we can get this one merged and discuss those changes separately. I'd be happy for you to take that follow-up on as well, if you still want to! I have actual review comments as well as these meta-comments, and I'll get to them soon. Thanks for your work on this PR, @dylandog95 ! |
|
@wbamberg Thank you for the feedback.
Per a different comment in reference to UI features Joe stated:
Due to this response I removed the UI features content.
I think this is the plan once we get this PR merged! I am learning a lot about the process here, so I am eager to tackle more issues! |
Oh! I think perhaps by "deprecation is appropriate" Joe might have meant "keep them, but mark them as deprecated". Which we do quite a lot in our docs. But anyway, let's see what the consensus is.
Good! |
|
For the explicit decision question:
I'm pretty sure I agree with this approach. If all of the window features had been tracked in browser compat data, their removal from browsers would've prompted removal from BCD and the page. For legacy values that still work (but behave like some other value) for compatibility, then I might suggest reporting that in BCD as an alternative name. But either way, I think it deserves little, if any, mention in the body text today. |
wbamberg
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry to be slow to get to this @dylandog95 .
I had a few comments. I think we have agreement that it's fine to remove those UI features bits. So if we can resolve the comments here we can merge this and then maybe have another PR to deal with the second half of this page.
Thanks again for your patience!
| var window = window.open(url, windowName, [windowFeatures]); | ||
| open(); | ||
| open(url); | ||
| open(url, windowName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason not to use target , as the spec does, rather than windowName?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no reason, other than it being a hold over from the old page. This has been updated.
| {{HTMLElement("iframe")}} or tab) into which to load the specified resource; if the | ||
| name doesn't indicate an existing context, a new window is created and is given the | ||
| name specified by `windowName`. | ||
| - `windowName` {{optional_inline}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again we could call this target. Is there a reason this page wants to use windowName?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above. Just a hold over.
| features include options such as the window's default size and position, whether or | ||
| not to open a minimal popup window, and so forth. See {{anch("Window features")}} | ||
| below for documentation of each of the features that can be specified. | ||
| - : A string containing a comma-separated list of window features in the form _name=value_ — or for boolean features, just _name_. These features include options such as the window's default size and position, whether or not to open a minimal popup window, and so forth. See {{anch("Window features")}} below for descriptions of each feature. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| - : A string containing a comma-separated list of window features in the form _name=value_ — or for boolean features, just _name_. These features include options such as the window's default size and position, whether or not to open a minimal popup window, and so forth. See {{anch("Window features")}} below for descriptions of each feature. | |
| - : A string containing a comma-separated list of window features in the form _name=value_ — or for boolean features, just _name_. These features include options such as the window's default size and position, whether or not to open a minimal popup window, and so forth. The following options are supported: |
I think it would be better to list the options here, in a nested <dl> (like https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options), rather than in a separate "Window features" section.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The requested changes have been made in the commit I just sent. This looks cleaner.
| of the new window as long as it complies with [Same-origin policy](/en-US/docs/Web/Security/Same-origin_policy) security | ||
| requirements. | ||
|
|
||
| ## Description |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is going. to be worth keeping "Description". We will eventually probably want to put some of the content from subsequent sections (Notes, Best practices etc) into there. For now it can give a quick prose overview of the behavior of this API. Something like:
The {{domxref("Window")}} interface's
open()method takes a URL as a parameter, and loads the resource it identifies into a new or existing tab or window. Thetargetparameter determines which window or tab to load the resource into, and thewindowFeaturesparameter can be used to control the size and position of a new window, and to open the new window as a popup with minimal UI features.Note that remote URLs won't load immediately. When
window.open()returns, the window always containsabout:blank. The actual fetching of the URL is deferred and starts after the current script block finishes executing. The window creation and the loading of the referenced resource are done asynchronously.
...or something like that anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I have added the description back onto the page.
|
|
||
| > **Note:** For accessibility reasons, it is strongly encouraged to set | ||
| > this feature always on. | ||
| > **Note:** If a popup is requested and no position features are specified, then the left and top coordinates of the new window will be offset 22 pixels from the original window. If the original window is maximized, the window will also be maximized. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This thing about 22 pixels seems to be Firefox-specific. Perhaps we could just remove the whole note?
| - [Obsolete features](/en-US/docs/Web/API/Window/open/Obsolete_features) | ||
| - [Privileged | ||
| features](/en-US/docs/Web/API/Window/open/Privileged_features) | ||
| - [Privileged features](/en-US/docs/Web/API/Window/open/Privileged_features) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should delete both these pages and these links.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These have been deleted through Yarn per instructions.
Co-authored-by: wbamberg <[email protected]>
|
Thanks for the update @dylandog95 . There were some other comments from my review: are you still planning to come back to them, or did you have any questions about them? |
Co-authored-by: wbamberg <[email protected]>
|
Thanks for the review @wbamberg! I started doing this and fell ill... but I am back good as new! I think I addressed all your requested changes in my latest commit. |
wbamberg
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry to hear you've been sick @dylandog95 . I hope you didn't feel pressured to complete this PR!
Anyway, I've fixed the merge conflicts and think this looks great now, much better than what we have. I think we should have a follow-up to organize and update all the Notes/FAQ/etc sections, and I'd be happy for you to work on that if you still want to. In the meantime I think we should merge this PR.
@jpmedley , this has a pending review from you, did you want to re-review this PR?
removal of UI windowFeatures was decided to be OK
|
I'm merging this so it doesn't rot again! Thanks for all your work on it @dylandog95 . I think it looks a lot better. If you still want to work on the next set of improvements to this page, please let me know! Maybe we could discuss it in #4583 ? |
Summary
This is a complete overhaul of the window.open() page and accomplishes the following:
Things that should be considered:
Hopefully I did this right!
Motivation
There is an open issue to overhaul this page. See below.
Supporting details
Related issues
Fixes #4583
Metadata