fix calendar weekday name with custom styles#5988
fix calendar weekday name with custom styles#5988atarek12 wants to merge 5 commits intoHacker0x01:mainfrom
Conversation
|
Please check the output of the failing CI |
|
Looks like there's a failing test here. Please resolve that. |
The previous change broke axe accessibility tests by using aria-label instead of the sr-only span pattern. Screen readers need visible text content in columnheader elements, not just aria-hidden spans. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5988 +/- ##
==========================================
+ Coverage 98.91% 99.21% +0.30%
==========================================
Files 30 30
Lines 3496 3579 +83
Branches 1470 1529 +59
==========================================
+ Hits 3458 3551 +93
+ Misses 37 27 -10
Partials 1 1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
The sr-only spans now work without importing the datepicker stylesheet. This fixes the issue where weekday names would be visible when using the component without the CSS import, while maintaining accessibility. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
Thank you for your PR! Unfortunately, we can't merge this change. The aria-label approach breaks axe accessibility tests with "empty-table-header" violations. When columnheader elements only contain , screen readers have no text to announce. The existing sr-only span pattern is the correct accessibility approach - it provides visible text for screen readers while hiding it visually. This pattern requires the CSS stylesheet to be imported, which is already expected for the component to function properly (layout, colors, positioning, etc.). If you're using the datepicker without importing the stylesheet, we'd recommend importing it or providing your own styles that include the .react-datepicker__sr-only class definition. |
Description
Linked issue: #(issue number)
Problem
There is an issue with weekday name when using
datepickercomponent without using datepicker stylesi.e:
import "react-datepicker/dist/react-datepicker.css";Changes
The issue has been introduced in this pr that fixes this issue.
But instead of using
sr-onlyclass on an extraspanelement which will be rendered if we don't import the stylesheet.I have reverted it back to use
aria-labelbut kept the innerspanwitharia-hidden="true"; so the screen-readers will skip it and announce thearia-labelprop.Screenshots
SundaySuContribution checklist