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 #4482: Update Month Picker and Year Picker to select dates also on press of "SPACE" key #4512

Conversation

balajis-qb
Copy link

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

Closes #4482

Description

This PR addresses the date selection behavior in the calendar component to enhance accessibility based on W3C WAI-ARIA principles. Previously, the Enter key alone is used to select a Month picker and a Year Picker. But As per the W3C WAI-ARIA principle, both the Enter & Space keys should be able to select a date. Currently, only the date selector is selecting a date on both the Enter and the Space key. Hence I updated the Year Picker and the Month Picker to work like the date picker to select a date both by Space and Enter keys.

Reference Link

Changes Made

  • Updated Year picker and Month picker to select values also on a click of the "Space" key in a similar way we handled on the date picker
  • Updated the corresponding test cases.

Adjust Month picker and Year picker to align with W3C WAI-ARIA principles.  Previously, the date gets selected only on "Enter" key press.  After this change, [both "Enter" and "Space" can select a date from both Month picker and Year picker](https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/examples/datepicker-dialog/)
Copy link

@pullrequest pullrequest bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ This pull request was sent to the PullRequest network.


@balajis-qb you can click here to see the review status or cancel the code review job.

Copy link

@pullrequest pullrequest bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PullRequest Breakdown

Reviewable lines of change

+ 62
- 0

76% JavaScript (tests)
24% JavaScript

Type of change

Fix - These changes are likely to be fixing a bug or issue.

Copy link

codecov bot commented Feb 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (753b1ff) 95.39% compared to head (7e82975) 95.41%.
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4512      +/-   ##
==========================================
+ Coverage   95.39%   95.41%   +0.01%     
==========================================
  Files          29       29              
  Lines        2521     2530       +9     
  Branches     1021     1023       +2     
==========================================
+ Hits         2405     2414       +9     
  Misses        116      116              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

@pullrequest pullrequest bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks fine but I do think you could define that constant in one central location

Image of Andy W Andy W


Reviewed with ❤️ by PullRequest

src/year.jsx Outdated Show resolved Hide resolved
Copy link

@pullrequest pullrequest bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without expanding the scope of the requested change, this appears to be the most sensible way to do it. A part of me would welcome a refactor of this code to simplify it, but the ROI may not be there on this.

Found a small likely typo/copy&paste error.

Hope you found this review helpful.

Image of John G John G


Reviewed with ❤️ by PullRequest

test/year_picker_test.test.js Outdated Show resolved Hide resolved
Copy link

@pullrequest pullrequest bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PullRequest reviewed the updates made to #4512 up until the latest commit (7e82975). No further issues were found.

Reviewed by:

Image of John G John G

@martijnrusschen martijnrusschen merged commit 833bb68 into Hacker0x01:main Feb 13, 2024
6 checks passed
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.

Month in Month Picker and Year in Year Picker cannot be selected by pressing the "Space" on keyboard.
2 participants