fix(overlay): Overlay trigger directive content not announced by screen readers #5808
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
When using the
trigger()
directive(e.g., ${trigger(popover)}),
overlay content was not being announced by screen readers. TheClickController was missing the
prepareDescription()method that establishes the ARIA relationship between the trigger and overlay content, unlike
HoverControllerand
LongpressController` which already had this functionality.Solution
Added
prepareDescription()
toClickController
Implemented the missing method following the same pattern as
HoverController:
aria-describedby
on the trigger to reference overlay contentMade
prepareDescription()
idempotentAdded guards to prevent duplicate calls:
Added
observeOverlayElements()
inInteractionController
Handles async content loading:
Improved trigger change handling in
Overlay.willUpdate()
When the trigger element changes:
Motivation and context
Before: Click-triggered overlays were not announced by screen readers
After: All trigger types (click, hover, longpress) properly announce overlay content via aria-describedby
Related issue(s)
Screenshots (if appropriate)
Author's checklist
Reviewer's checklist
patch
,minor
, ormajor
featuresManual review test cases
Descriptive Test Statement
Descriptive Test Statement
Device review