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

Fix #4483: Enable onKeyDown handler for the month picker view and the year picker view #14

Merged

Conversation

balajis-qb
Copy link
Collaborator

@balajis-qb balajis-qb commented Feb 26, 2024

Closes Hacker0x01#4483

Description
This PR addresses the missing event handling to handle the key-press event for the month picker and the year picker. For the Year Picker component, I added onKeyDown and mapped it to the corresponding prop. But, however the MonthPicker (month.jsx) is already receiving onKeyDown event, but that was mapped to the handler handleOnDayKeyDown which is the handler specifically we're using on day.jsx. In month.jsx we're not directly using it, but passing that to the Week component. Hence for the month.jsx alone, I didn't change any of it's current behaviour, and I added a new prop named handleOnMonthKeyDown which is linked to onKeyDown event handler we pass from the DatePicker component. So users can still use onKeyDown itself for any datepicker view (day/month/year), but internally month.jsx alone is handling it via handleOnMonthKeyDown.

Changes Made

  • Updated Year picker and Month picker to handle the onKeyDown event.
  • Updated the corresponding test cases.

Balaji Sridharan added 3 commits February 25, 2024 22:35
Used `handleOnMonthKeyDown` for MonthPicker component to handle Key down events as the `handleOnKeyDown` prop was linked with `handleOnDayKeyDown` (& passed to the Week component)
@balajis-qb balajis-qb merged commit 89249a5 into main Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

onKeyDown function is not triggered in Month and Year Pickers.
1 participant