Skip to content

Input blur after date select #4844

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

Closed
MardanovaA opened this issue May 30, 2024 · 1 comment · Fixed by qburst/react-datepicker-3#23 or #4878
Closed

Input blur after date select #4844

MardanovaA opened this issue May 30, 2024 · 1 comment · Fixed by qburst/react-datepicker-3#23 or #4878

Comments

@MardanovaA
Copy link

Date picker does not blur input after date select.

Steps to reproduce the behavior:

  1. Go to https://reactdatepicker.com//#example-default
  2. Click on date input field
  3. Select any date
  4. Calendar closes, but input stay focused.

Expected behavior
Calendar closes, input blurs.

Even worse:
5. Go to another browser tab
6. Return to date picker tab
7. Calendar is open.
Expected behavior
Calendar is closed

I set handleBlur function for onBlur, onSelect and onCalendarClose events. I think, that input loses focus for a split second, after executing itCalendarCloses, but then comes into focus again

const handleBlur = () => {
   pickerRef.current?.input?.blur(); // it doesn't work
  
  setTimeout(() => {
        pickerRef.current?.input?.blur(); // it is works
  }, 1000);
};

Any help how can I control input focus, please?

@balajis-qb
Copy link
Contributor

I'll look into this issue

balajis-qb pushed a commit to qburst/react-datepicker-3 that referenced this issue Jun 7, 2024
balajis-qb pushed a commit to qburst/react-datepicker-3 that referenced this issue Jun 7, 2024
martijnrusschen added a commit that referenced this issue Jun 7, 2024
…pen-state-on-document-visibility-toggle

Fix #4844: 🔨 Retain the open state of the calendar popup on document visibility change
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants