react-date-picker icon indicating copy to clipboard operation
react-date-picker copied to clipboard

Denying first `shouldCloseCalendar` turns `Enter` keydown behaviour from `reason` type of `buttonClick` to `select`

Open hokwanhung opened this issue 2 years ago • 0 comments

Before you start - checklist

  • [X] I followed instructions in documentation written for my React-Date-Picker version
  • [X] I have checked if this bug is not already reported

Description

Perhaps it is intended and it's more like an issue, but I found out that for the property of shouldCloseCalendar, if the first trigger is denied, the reason type of Enter keydown behaviour would change from buttonClick to select.

This is somehow important as some users might want to press Enter for confirming their input, and if I want to limit the shouldCalendarClose property to, for example, only clicking on icon or pressing Enter key, it is hard to do so (at least it is best to be stable with the reason type, I think).

Steps to reproduce

I have reproduced the problem in CodeSandbox for anyone that wants to take a look at it:

Edit react-date-picker-shouldCloseCalendar-issue

Expected behavior

The reason type of pressing Enter key remains in buttonClick anytime the shouldCloseCalendar triggers, or it would be select all the time.

Actual behavior

The reason type of pressing Enter key changes from reason type of buttonClick to select starting from the second trigger on shouldCloseCalendar.

Additional information

No response

Environment

  • Browser (if applicable): Microsoft Edge Version 119.0.2151.97 (Official build) (64-bit)
  • React-Date-Picker version: ^10.5.2
  • React version: ^18.2.0

hokwanhung avatar Dec 09 '23 09:12 hokwanhung