-
Notifications
You must be signed in to change notification settings - Fork 14
A11y-Update für DBSwitch #5624
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
base: main
Are you sure you want to change the base?
A11y-Update für DBSwitch #5624
Conversation
…lity in DBSwitch component
|
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…n in Windows/NVDA
…bel and improve comment capitalization
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…nt label handling
…pplied-to-elements' of https://github.com/db-ux-design-system/core-web into 5495-changing-language-with-aria-labels-not-correctly-applied-to-elements
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
|
@sarahbrng only making some of those |
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…correctly-applied-to-elements
…pplied-to-elements' of https://github.com/db-ux-design-system/core-web into 5495-changing-language-with-aria-labels-not-correctly-applied-to-elements
| aria-label={props.ariaLabel} | ||
| aria-labelledby={props.ariaLabelledBy ?? state._labelId} |
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.
According to the ARIA accessible name computation (W3C) and ARIA Authoring Practices, aria-labelledby takes precedence over aria-label. If both are present, aria-label is ignored.
So if aria-labelledby is present, wo do not need to set aria-label.
…correctly-applied-to-elements
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…pplied-to-elements' of https://github.com/db-ux-design-system/core-web into 5495-changing-language-with-aria-labels-not-correctly-applied-to-elements
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…pplied-to-elements' of https://github.com/db-ux-design-system/core-web into 5495-changing-language-with-aria-labels-not-correctly-applied-to-elements
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…licts The onMount hook in switch.lite.tsx was using state._id immediately after setting it to construct derived IDs (_labelId, _messageId, etc.). In React, this compiled to useState setters which don't update values synchronously, causing all derived IDs to be based on undefined/_id instead of the new ID value. This resulted in all switches on a page sharing the same broken label IDs, making screen readers announce the first switch's label for all switches. Fix: Use a local const variable to hold the ID value, ensuring all derived IDs are correctly constructed from the same value in a single pass. Fixes rendering bug introduced in commit 040e72a which added aria-labelledby support.
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…licts The onMount hook in switch.lite.tsx was using state._id immediately after setting it to construct derived IDs (_labelId, _messageId, etc.). In React, this compiled to useState setters which don't update values synchronously, causing all derived IDs to be based on undefined/_id instead of the new ID value. This resulted in all switches on a page sharing the same broken label IDs, making screen readers announce the first switch's label for all switches. Fix: Use a local const variable to hold the ID value, ensuring all derived IDs are correctly constructed from the same value in a single pass. Fixes rendering bug introduced in commit 040e72a which added aria-labelledby support.
…pplied-to-elements' of https://github.com/db-ux-design-system/core-web into 5495-changing-language-with-aria-labels-not-correctly-applied-to-elements
Proposed changes
Das Problem: Bisher wurden ARIA-Labels beim Laden der Komponente einmalig gesetzt ("Snapshotted"). Bei dynamischen Änderungen zur Laufzeit (z. B. Sprachwechsel via i18n) blieb der Screenreader-Text veraltet.
Die Lösung: Die Inputs ariaLabel und ariaLabelledBy sind nun reaktive Props somit werden Änderungen sofort an das innere
input[type="checkbox"]weitergegeben. Der Accessible Name ist immer live aktuell.aria-labelbindet anariaLabel.aria-labelledbybindet anariaLabelledBy.resolves #5495
Types of changes
Further comments
🔭🐙🐈 Test this branch here: https://design-system.deutschebahn.com/core-web/review/5495-changing-language-with-aria-labels-not-correctly-applied-to-elements