Skip to content

fix: allow keyboard year selection without selected date - #6315

Open
wanxiankai wants to merge 1 commit into
Hacker0x01:mainfrom
wanxiankai:fix/year-picker-enter-key
Open

fix: allow keyboard year selection without selected date#6315
wanxiankai wants to merge 1 commit into
Hacker0x01:mainfrom
wanxiankai:fix/year-picker-enter-key

Conversation

@wanxiankai

Copy link
Copy Markdown

Description

Fixes #6298

Problem

When showYearPicker is enabled without an initial selected date, the year cells could be clicked with the mouse but pressing Enter on a focused year did nothing. The keyboard handler returned early whenever selected was nullish, so keyboard-only users could not select a year.

Changes

  • Route Enter through the same year-selection handler used by mouse clicks.
  • Keep the existing pre-selection update for controlled pickers that already have a selected date.
  • Add regression coverage for selecting a year with Enter when no date is selected, including the DatePicker integration path.

Verification

  • yarn test src/test/year_picker_test.test.tsx --runInBand --watchman=false
  • yarn type-check
  • yarn eslint src/year.tsx src/test/year_picker_test.test.tsx
  • yarn prettier --check src/year.tsx src/test/year_picker_test.test.tsx

Contribution checklist

  • I have followed the contributing guidelines.
  • I have added sufficient test coverage for my changes.
  • I have formatted my code with Prettier and checked for linting issues with ESLint for code readability.

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.

YearPicker: Enter key does not select year when selected is null/undefined

1 participant