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

Migrate to Popper from Popover #1850

Merged
merged 33 commits into from
Jun 28, 2020
Merged

Migrate to Popper from Popover #1850

merged 33 commits into from
Jun 28, 2020

Conversation

dmtrKovalenko
Copy link
Member

@dmtrKovalenko dmtrKovalenko commented Jun 2, 2020

This PR closes #1426 and also closes #1835

@vercel
Copy link

vercel bot commented Jun 2, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/mui-org/material-ui-pickers/1js21bv2h
✅ Preview: https://material-ui-pickers-git-feature-migrate-to-popper.mui-org.vercel.app

@cypress
Copy link

cypress bot commented Jun 2, 2020



Test summary

75 0 3 0


Run details

Project material-ui-pickers
Status Passed
Commit 72c0c89
Started Jun 28, 2020 8:16 AM
Ended Jun 28, 2020 8:20 AM
Duration 04:04 💡
OS Linux Debian - 10.0
Browser Chrome 80

View run in Cypress Dashboard ➡️


This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

@vercel vercel bot temporarily deployed to Preview June 2, 2020 10:46 Inactive
@vercel vercel bot temporarily deployed to Preview June 2, 2020 10:47 Inactive
@vercel vercel bot temporarily deployed to Preview June 2, 2020 10:48 Inactive
@vercel vercel bot temporarily deployed to Preview June 2, 2020 10:52 Inactive
@dmtrKovalenko
Copy link
Member Author

One difference I am seeing – Popover doesn't return the focus back to the open button when closed. Any ideas @oliviertassinari

@vercel vercel bot temporarily deployed to Preview June 2, 2020 11:22 Inactive
Copy link
Member

@oliviertassinari oliviertassinari left a comment

Choose a reason for hiding this comment

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

I did a quick review. I'm happy that we move forward in this direction :).

One difference I am seeing – Popover doesn't return the focus back to the open button when closed. Any ideas @oliviertassinari?

I have also noticed that it breaks the scroll position.

Comment on lines 40 to 45
'&:focus': {
outline: 'auto',
[IS_TOUCH_DEVICE_MEDIA]: {
outline: 0,
},
},
Copy link
Member

Choose a reason for hiding this comment

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

We can remove redundant default for simplicity until we solve the root issue.

Suggested change
'&:focus': {
outline: 'auto',
[IS_TOUCH_DEVICE_MEDIA]: {
outline: 0,
},
},
[IS_TOUCH_DEVICE_MEDIA]: {
outline: 0,
},

Copy link
Member

Choose a reason for hiding this comment

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

bump

transformOrigin: 'bottom center',
},
}),
{ name: 'MuiPickersPopper' }
Copy link
Member

@oliviertassinari oliviertassinari Jun 2, 2020

Choose a reason for hiding this comment

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

s or not? It doesn't match the name of the file. Which one should be fix?

Suggested change
{ name: 'MuiPickersPopper' }
{ name: 'MuiPickerPopper' }

Copy link
Member Author

Choose a reason for hiding this comment

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

I think we will have some kind of name consolidation PR, so it will be easier to find all names by "MuiPickers"

Copy link
Member

Choose a reason for hiding this comment

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

Sounds great, I love fighting entropy with consistency 😁

Copy link
Member

Choose a reason for hiding this comment

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

Ok so if we refer to #1778, I think that we can use MuiPickersPopper, but rename the file to
lib/src/_shared/PickersPopper.tsx

Copy link
Member

Choose a reason for hiding this comment

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

bump

lib/src/_shared/PickerPopper.tsx Outdated Show resolved Hide resolved
lib/src/_shared/PickerPopper.tsx Outdated Show resolved Hide resolved
const handlePopperRef = useForkRef(paperRef, innerRef);

useGlobalKeyDown(open, {
[keycode.Esc]: onClose,
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to listen globally to the Escape key? What prevent to scope the listener to the container?

Copy link
Member Author

Choose a reason for hiding this comment

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

It is not always focused on popper (DateRangePicker)

Copy link
Member

@oliviertassinari oliviertassinari Jun 2, 2020

Choose a reason for hiding this comment

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

The date range picker case makes me think of mui/material-ui#17279.
For the date picker, I was under the assumption that the component will always close on blur. Hence, we can listen to the key event on the root.

lib/src/wrappers/DesktopTooltipWrapper.tsx Outdated Show resolved Hide resolved

return (
<WrapperVariantContext.Provider value="desktop">
<KeyboardDateInputComponent {...DateInputProps} containerRef={ref} />
<KeyboardDateInputComponent {...DateInputProps} containerRef={inputRef} />
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't listen to the "Input" rather than the "container"? The popup open bellow the helper text, I believe it should open below the <input /> element.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe it's a good opportunity to solve #1768? I don't know.

@BrentFarese
Copy link

@dmtrKovalenko any idea on the next release time line? Just curious as we're checking this PR and waiting for it to hit. Thanks! Great library!

lib/src/__tests__/DatePicker.test.tsx Outdated Show resolved Hide resolved
lib/src/__tests__/DatePicker.test.tsx Outdated Show resolved Hide resolved
lib/src/_shared/PickerPopper.tsx Outdated Show resolved Hide resolved
Comment on lines 40 to 45
'&:focus': {
outline: 'auto',
[IS_TOUCH_DEVICE_MEDIA]: {
outline: 0,
},
},
Copy link
Member

Choose a reason for hiding this comment

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

bump

transformOrigin: 'bottom center',
},
}),
{ name: 'MuiPickersPopper' }
Copy link
Member

Choose a reason for hiding this comment

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

bump

lib/src/_shared/PickerPopper.tsx Outdated Show resolved Hide resolved
lib/src/_shared/PickerPopper.tsx Outdated Show resolved Hide resolved
Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com>
@vercel vercel bot temporarily deployed to Preview June 27, 2020 09:06 Inactive
Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com>
@vercel vercel bot temporarily deployed to Preview June 27, 2020 09:06 Inactive
@vercel vercel bot temporarily deployed to Preview June 27, 2020 09:08 Inactive
Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com>
Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com>
@dmtrKovalenko dmtrKovalenko merged commit b62ce2a into next Jun 28, 2020
@dmtrKovalenko dmtrKovalenko deleted the feature/migrate-to-Popper branch June 28, 2020 08:23
@diegovillacis10
Copy link

Since which version this change will be available?

@dmtrKovalenko
Copy link
Member Author

It is already available with the latest v4 alpha

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PopoverProps are not passed down to Popover component Use Popper over Popover for desktop?
4 participants