-
Couldn't load subscription status.
- Fork 18
feat: enhance accessibility by adding descriptive label to theme toggle #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
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## sumac/indigo #29 +/- ##
================================================
+ Coverage 68.39% 68.45% +0.05%
================================================
Files 49 49
Lines 481 485 +4
Branches 107 107
================================================
+ Hits 329 332 +3
- Misses 149 150 +1
Partials 3 3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me
| const themeCookieExpiry = 90; // days | ||
|
|
||
| const ThemeToggleButton = ({ intl }) => { | ||
| const [isDarkThemeEnabled, setIsDarkThemeEnabled] = useState(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is there a need for a state? This file already uses themeCookie/cookie to manage the dark theme toggle across sessions. Can't the same be followed for a11y?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DawoudSheraz The state ensures the UI updates immediately when toggled, while the cookie handles persistence. Without state, the toggle’s visual feedback and screen reader announcements wouldn’t sync until a page reload, hurting both UX and accessibility.
* fix: Add visible titles to image-based links * feat: enhance accessibility by adding descriptive label to theme toggle (#29) * feat: Header - Focus order meaning - Open Edx Demo Course (#30) * feat: Header - Focus order meaning - Open Edx Demo Course * refactor: unify responsive rendering using the existing Responsive component Co-authored-by: Rahat Ali <rahat.ali@arbisoft.com> Co-authored-by: hinakhadim <hina.khadim@arbisoft.com>
* fix: Add visible titles to image-based links * feat: enhance accessibility by adding descriptive label to theme toggle (#29) * feat: Header - Focus order meaning - Open Edx Demo Course (#30) * feat: Header - Focus order meaning - Open Edx Demo Course * refactor: unify responsive rendering using the existing Responsive component Co-authored-by: Rahat Ali <rahat.ali@arbisoft.com> Co-authored-by: hinakhadim <hina.khadim@arbisoft.com>
* fix: Add visible titles to image-based links * feat: enhance accessibility by adding descriptive label to theme toggle (#29) * feat: Header - Focus order meaning - Open Edx Demo Course (#30) * feat: Header - Focus order meaning - Open Edx Demo Course * refactor: unify responsive rendering using the existing Responsive component Co-authored-by: Rahat Ali <rahat.ali@arbisoft.com> Co-authored-by: hinakhadim <hina.khadim@arbisoft.com>
* fix: Add visible titles to image-based links * feat: enhance accessibility by adding descriptive label to theme toggle (#29) * feat: Header - Focus order meaning - Open Edx Demo Course (#30) * feat: Header - Focus order meaning - Open Edx Demo Course * refactor: unify responsive rendering using the existing Responsive component Co-authored-by: Rahat Ali <rahat.ali@arbisoft.com> Co-authored-by: hinakhadim <hina.khadim@arbisoft.com>
* fix: Add visible titles to image-based links * feat: enhance accessibility by adding descriptive label to theme toggle (#29) * feat: Header - Focus order meaning - Open Edx Demo Course (#30) * feat: Header - Focus order meaning - Open Edx Demo Course * refactor: unify responsive rendering using the existing Responsive component Co-authored-by: Rahat Ali <rahat.ali@arbisoft.com> Co-authored-by: hinakhadim <hina.khadim@arbisoft.com>
📄 Description
This PR enhances the accessibility of the theme toggle switch in the shared header component by improving how it is announced to screen readers. This update ensures users who rely on assistive technologies can understand the purpose of the toggle and interact with it effectively.
The change aligns with WCAG Success Criterion 4.1.2 – Name, Role, Value, which requires that user interface elements expose meaningful names and roles programmatically.
🎯 Issue
Actual Result:
The theme toggle (used to switch between light and dark modes) did not have an accessible name. As a result, screen readers could not interpret or announce its function, making it difficult for visually impaired users to understand its purpose.
Expected Behaviour:
The toggle should expose a descriptive label to screen readers that clearly communicates its action — for example, “Switch to dark theme.”
✅ Fix
🔗 Related