-
Notifications
You must be signed in to change notification settings - Fork 29
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
feat(react/Calendar): enhance keyboard navigation and date selection #909
Conversation
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
🦋 Changeset detectedLatest commit: 186083f The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## v2 #909 +/- ##
==========================================
- Coverage 78.84% 77.72% -1.12%
==========================================
Files 378 377 -1
Lines 6168 6295 +127
==========================================
+ Hits 4863 4893 +30
- Misses 1305 1402 +97
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Tonic UI Demo
|
9ab9c81
to
f226836
Compare
f8dddc3
to
11b9ca1
Compare
Calendar
component
@cheton There is a side effect: when I try to select a date for the next month (September 20), the Calendar UI jumps back to the current month (August). Screen.Recording.2024-08-19.at.9.50.41.AM.mov |
@trend-albert-shala Could you help check the keyboard navigation behavior in the demo? |
@cheton the changes look good, tested the options outlined under Operation Keys, and they're working as expected. Btw I'm on a Mac, if additional testing on a Windows machine is needed |
Thank you for confirming. We have tested it on both Windows and Mac, using Chrome and Safari browsers. For Safari, users will need to enable "Tab" navigation first:
|
…sable` Add a check to ensure `getAllFocusable` returns an empty array when the input is not a valid HTMLElement.
- Added `isPointerDownRef` to differentiate between pointer and keyboard focus initiation. - Fixed focus event handling to correctly skip focus handling when initiated by pointer devices.
Demo: https://trendmicro-frontend.github.io/tonic-ui-demo/react/pr-909/components/date-pickers/calendar
New Updates
ArrowLeft
,ArrowRight
,ArrowUp
,ArrowDown
,Home
, andEnd
keys to navigate between days in month view.TAB
orTAB
+SHIFT
to navigate from outside the calendar into it, the focus should be set to today’s date or the specified selected date.SPACE
orENTER
keys'Operation Keys
Tab
Shift
+Tab
Space
orEnter
on the arrow buttons (⬅️➡️)ArrowUp
orArrowDown
keys to increase or decrease current yearEnter
orSpace
to select date.