Skip to content

Conversation

@sarahbrng
Copy link
Contributor

@sarahbrng sarahbrng commented Dec 11, 2025

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-label bindet an ariaLabel.

aria-labelledby bindet an ariaLabelledBy.

resolves #5495

Types of changes

  • Bugfix (non-breaking change that fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactoring (improvements to existing components or architectural decisions)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)

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

@changeset-bot
Copy link

changeset-bot bot commented Dec 11, 2025

🦋 Changeset detected

Latest commit: 3406278

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 9 packages
Name Type
@db-ux/core-components Patch
@db-ux/ngx-core-components Patch
@db-ux/react-core-components Patch
@db-ux/wc-core-components Patch
@db-ux/v-core-components Patch
@db-ux/core-foundations Patch
@db-ux/core-stylelint Patch
@db-ux/core-migration Patch
@db-ux/agent-cli Patch

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

@sarahbrng sarahbrng moved this from 🏗 In progress to 🎁 Ready for review in UX Engineering Team Backlog Dec 11, 2025
github-actions bot and others added 2 commits December 11, 2025 10:55
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@github-actions github-actions bot added the 📺showcases Changes to 1-n showcases label Dec 12, 2025
github-actions bot and others added 5 commits December 12, 2025 10:45
github-actions bot and others added 2 commits December 12, 2025 12:51
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@mfranzke
Copy link
Collaborator

mfranzke commented Dec 13, 2025

@sarahbrng only making some of those aria-*-HTML-attribute reactive to changes might not be intuitive to the developers. I would have assumed that the existing mechanism for pass-throughs of those attributes even already takes care of this stuff, elsewhere we should optimize that functionality from my point of view, as this missing functionality would be expected equally at other attributes as well.

github-actions bot and others added 2 commits December 15, 2025 07:43
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
github-actions bot and others added 2 commits December 15, 2025 11:38
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
github-actions bot and others added 4 commits December 15, 2025 14:09
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
github-actions bot and others added 3 commits December 15, 2025 15:48
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.
github-actions bot and others added 4 commits December 16, 2025 12:12
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
michaelmkraus
michaelmkraus previously approved these changes Dec 19, 2025
@github-project-automation github-project-automation bot moved this from 🎶 Waiting for feedback to ⏰ready for release in UX Engineering Team Backlog Dec 19, 2025
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is a fix we would like to communicate, so a changeset is missing in this.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm struggling with the approach to only making some of those aria-*-HTML-attribute in one component in our system "reactive" to changes might not be intuitive to the developers. I would have assumed that the existing mechanism for pass-throughs of those attributes even already takes care of this stuff, elsewhere we should optimize that functionality from my point of view, as this missing functionality would be expected equally at other attributes as well.

@mfranzke
Copy link
Collaborator

mfranzke commented Dec 23, 2025

@michaelmkraus @sarahbrng this PR is still draft, but approved.

@sarahbrng
Copy link
Contributor Author

only making some of those aria-*-HTML-attribute reactive to changes might not be intuitive to the developers. I would have assumed that the existing mechanism for pass-throughs of those attributes even already takes care of this stuff, elsewhere we should optimize that functionality from my point of view, as this missing functionality would be expected equally at other attributes as well.

Yes, that is right:
I suggest we investigate improving the core attribute pass-through mechanism in our component framework (Mitosis) to ensure all ARIA attributes are reactive by default. This would:

  • Fix the issue systematically across all components
  • Align with developer expectations
  • Prevent similar issues in the future

I suggest: Keep this PR as-is (targeted fix for the immediate accessibility bug) and create a follow-up issue to address the architectural concern, what do you think @mfranzke ?

@sarahbrng sarahbrng marked this pull request as ready for review December 30, 2025 10:46
@github-actions github-actions bot added the 📕documentation Improvements or additions to documentation label Dec 30, 2025
@mfranzke
Copy link
Collaborator

only making some of those aria-*-HTML-attribute reactive to changes might not be intuitive to the developers. I would have assumed that the existing mechanism for pass-throughs of those attributes even already takes care of this stuff, elsewhere we should optimize that functionality from my point of view, as this missing functionality would be expected equally at other attributes as well.

Yes, that is right:

I suggest we investigate improving the core attribute pass-through mechanism in our component framework (Mitosis) to ensure all ARIA attributes are reactive by default. This would:

  • Fix the issue systematically across all components

  • Align with developer expectations

  • Prevent similar issues in the future

I suggest: Keep this PR as-is (targeted fix for the immediate accessibility bug) and create a follow-up issue to address the architectural concern, what do you think @mfranzke ?

Let's discuss in the team next week. Providing this fix in the meantime would introduce this "inconsistency" (not a huge thing, but still), and we would be able to wait for the big solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🏘components 📕documentation Improvements or additions to documentation 📺showcases Changes to 1-n showcases

Projects

Status: ⏰ready for release

Development

Successfully merging this pull request may close these issues.

Changing language with aria-labels not correctly applied to elements

4 participants