Hacker0x01 / react-datepicker

A simple and reusable datepicker component for React
https://reactdatepicker.com/
MIT License
7.89k stars 2.23k forks source link

Able to focus on disabled months. #4847

Open asada-no4 opened 1 month ago

asada-no4 commented 1 month ago

Describe the bug The month that has been set to disabled by setting maxDate or minDate receives focus when the tab key is pressed.

To Reproduce Steps to reproduce the behavior:

  1. Set showMonthYearPicker to display the month picker
  2. Disable December using maxDate
  3. Display the previous year
  4. Press the tab key to focus on the month, and press the crosshair key to focus on December.
  5. Click the Arrow button to display the following year
  6. Press tab key to focus on the month←Focus is given to December in the disable state

Expected behavior Focus will be on November in ACTIVE state.

balajis-qb commented 1 month ago

Hi @asada-no4 , it's working for me. can you please share the code

asada-no4 commented 1 month ago

Hi @balajis-qb , thank you for confirming. Since it is difficult to share the code, I will share the example page of the datepicker. https://reactdatepicker.com/#example-exclude-months-in-month-picker The same procedure is buggy in the above EXCLUDED month.

asada-no4 commented 1 month ago

https://reactdatepicker.com/#example-month-picker Or add the following line to the above code

maxDate={new Date().setMonth(10)}

balajis-qb commented 1 month ago

Hi @asada-no4 ,

I understand the issue now, I'll try to fix it. Thank you for raising it.