Skip to content

fix(ui5-button): update aria-label when accessibleNameRef target changes#13104

Open
ilhan007 wants to merge 2 commits intomainfrom
fix-btn-accessibleNameRef-usage
Open

fix(ui5-button): update aria-label when accessibleNameRef target changes#13104
ilhan007 wants to merge 2 commits intomainfrom
fix-btn-accessibleNameRef-usage

Conversation

@ilhan007
Copy link
Contributor

@ilhan007 ilhan007 commented Feb 17, 2026

Summary

  • Button now observes changes to elements referenced via accessibleNameRef and updates its aria-label accordingly
  • Previously, the aria-label would only update when the Button re-rendered for other reasons (e.g., being clicked)
  • The fix registers the Button with AccessibilityTextsHelper to observe mutations on referenced elements, matching the behavior of Input and other components

Test plan

  • Added test case in AccessibilityTextsHelper.cy.tsx that verifies multiple buttons referencing the same label all update when the label's text changes
  • All existing Button tests pass (35/35)
  • All AccessibilityTextsHelper tests pass (10/10)

Fixes #13101


🤖 Analyzed, fixed and PR created by Claude Code

Button now observes changes to elements referenced via accessibleNameRef
and updates its aria-label accordingly. Previously, the aria-label would
only update when the Button re-rendered for other reasons.

The fix registers the Button with AccessibilityTextsHelper to observe
mutations on referenced elements, matching the behavior of Input and
other components.

Fixes #13101
@ui5-webcomponents-bot
Copy link
Collaborator

ui5-webcomponents-bot commented Feb 17, 2026

@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview February 17, 2026 13:46 Inactive
Only cache accessibleNameRef texts (which require DOM lookups and
mutation observation). Use accessibleName property directly in the
getter, matching the pattern used by Input component.

This fixes the issue where dynamically setting accessibleName (e.g.,
from Panel's useAccessibleNameForToggleButton) wasn't reflected
because the cached value wasn't updated.
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.

Button: accessible name (defined by accessibleNameRef) is not up to date

2 participants