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

Disable default centering (#47) and improve typings #48

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

andrewsantarin
Copy link

So, learning that #47 is easily overcome with center={false} (I really, really thought that react-new-window is hardcoded to use some kind of centering), I wanted to improve the quality of life a bit by making center undefined at the start.

Also, I've added additional attribs to the IWindowFeatures interface so that it's clear what attributes go to the features prop. Referenced from react-popout-component, figured the interface could be useful since that library hasn't seen new merged commits in almost a year...

Feel free to roast my commit if it means writing even better code. :)

@@ -24,7 +24,6 @@ class NewWindow extends React.PureComponent {
onBlock: null,
onOpen: null,
onUnload: null,
center: 'parent',
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will change a default.

if (typeof center === 'string') {
if (features.width == null || features.height == null) {
console.warn(
'react-new-window: "width" and "height" window features must be present when a center prop is provided.'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love that detail.

Comment on lines +16 to +23
left: number
top: number
menubar: boolean
toolbar: boolean
scrollbars: boolean
location: boolean
status: boolean
resizable: boolean
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems valid window feature are limited to: popup, width, height, left, top, noopener and noreferrer. The others are no longer working in modern browser.

Copy link
Owner

@rmariuzzo rmariuzzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks pretty good. I will merge and test locally and decide for a release.

@rmariuzzo rmariuzzo added this to the next milestone Nov 28, 2022
@rmariuzzo rmariuzzo self-assigned this Nov 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants