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

DatePicker popover close unexpectedly in Chrome when moving to min/max month #3603

Closed
silviodeligios opened this issue Jun 14, 2019 · 4 comments · Fixed by #4316
Closed

DatePicker popover close unexpectedly in Chrome when moving to min/max month #3603

silviodeligios opened this issue Jun 14, 2019 · 4 comments · Fixed by #4316

Comments

@silviodeligios
Copy link

Steps to reproduce

In the dateInput component

  1. set the start value to null or delete the selected date
  2. use the arrows to change month
  3. if your max date is, for example, 2019-12-31 when you are on November 2019, if you click the next month button the date picker close unexpectedly
@MrMengJ
Copy link

MrMengJ commented Aug 26, 2019

Steps to reproduce

In the dateInput component

  1. set the start value to null or delete the selected date
  2. use the arrows to change month
  3. if your max date is, for example, 2019-12-31 when you are on November 2019, if you click the next month button the date picker close unexpectedly

Hi! Have you solved this problem? I encountered this problem too.

@ejose19
Copy link
Contributor

ejose19 commented Sep 6, 2020

I've got this too, here's a sandbox, without selecting any date, just move with the month arrows and it will close.

Worth noting this work correctly on firefox, but on chrome it closes as soon the month reaches the min/max date

@adidahiya
Copy link
Contributor

Thanks for the sandbox @ejose19. Note that it only closes unexpectedly when no date is selected. If you first select a valid date, then reopen the picker and move to the min/max month, the popover stays open as expected.

@adidahiya adidahiya changed the title DatePicker close unexpectedly DatePicker popover close unexpectedly in Chrome when moving to min/max month Sep 8, 2020
@adidahiya
Copy link
Contributor

adidahiya commented Sep 8, 2020

What's happening is the prev/next month button gets disabled when you reach the date bounds. In Chrome, this causes that <button> to lose focus, triggering a "blur" of the popover, closing the DateInput. Iff a date is selected (defaultValue != null || value != null), the <input> receives focus again, which reopens the popover, thus hiding the bug:

2020-09-08 16 47 20

It seems like the Firefox behavior might actually be a bug in FF (https://bugzilla.mozilla.org/show_bug.cgi?id=1650092). So the fix here needs to tweak handlePopoverBlur to not close the popover when the blurring happens due to a month change.

In playing around with the keyboard accessibility of the component, I can see that it's not perfect, but I would still like to retain the functionality added in #2093 which closes the DateInput popover after a user TABs out of the last tabbable element in the popover.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants