Skip to content

Conversation

Rajdeepc
Copy link
Contributor

@Rajdeepc Rajdeepc commented Oct 15, 2025

Description

When using the trigger() directive (e.g., ${trigger(popover)}), overlay content was not being announced by screen readers. The ClickController was missing the prepareDescription()method that establishes the ARIA relationship between the trigger and overlay content, unlikeHoverControllerandLongpressController` which already had this functionality.

Solution

  1. Added prepareDescription() to ClickController
    Implemented the missing method following the same pattern as HoverController:

    • Determines the appropriate ARIA strategy based on DOM tree relationships
    • Sets aria-describedby on the trigger to reference overlay content
    • Provides proper cleanup via releaseDescription()
  2. Made prepareDescription() idempotent
    Added guards to prevent duplicate calls:

override releaseDescription = noop;

override prepareDescription(): void {
    // Do not reapply until target is recycled
    if (this.releaseDescription !== noop) return;
    // ... rest of implementation
}
  1. Added observeOverlayElements() in InteractionController
    Handles async content loading:

    • Waits for overlay.updateComplete
    • Calls prepareDescription() when elements are ready
    • Ensures aria-describedby is set even when content loads after the overlay is created
  2. Improved trigger change handling in Overlay.willUpdate()
    When the trigger element changes:

    • Releases description from the old trigger
    • Binds new events
    • Prepares description for the new trigger (if elements are already present)

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)

  • fixes [Issue Number]

Screenshots (if appropriate)


Author's checklist

  • I have read the CONTRIBUTING and PULL_REQUESTS documents.
  • I have reviewed at the Accessibility Practices for this feature, see: Aria Practices
  • I have added automated tests to cover my changes.
  • I have included a well-written changeset if my change needs to be published.
  • I have included updated documentation if my change required it.

Reviewer's checklist

  • Includes a Github Issue with appropriate flag or Jira ticket number without a link
  • Includes thoughtfully written changeset if changes suggested include patch, minor, or major features
  • Automated tests cover all use cases and follow best practices for writing
  • Validated on all supported browsers
  • All VRTs are approved before the author can update Golden Hash

Manual review test cases

  • Descriptive Test Statement

    1. Go here
    2. Do this action
    3. Expect this result
  • Descriptive Test Statement

    1. Go here
    2. Do this action
    3. Expect this result

Device review

  • Did it pass in Desktop?
  • Did it pass in (emulated) Mobile?
  • Did it pass in (emulated) iPad?

@changeset-bot
Copy link

changeset-bot bot commented Oct 15, 2025

⚠️ No Changeset found

Latest commit: cfcbaec

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions
Copy link
Contributor

📚 Branch Preview

🔍 Visual Regression Test Results

When a visual regression test fails (or has previously failed while working on this branch), its results can be found in the following URLs:

Deployed to Azure Blob Storage: pr-5808

If the changes are expected, update the current_golden_images_cache hash in the circleci config to accept the new images. Instructions are included in that file.
If the changes are unexpected, you can investigate the cause of the differences and update the code accordingly.

@github-actions
Copy link
Contributor

Tachometer results

Currently, no packages are changed by this PR...

@coveralls
Copy link
Collaborator

Pull Request Test Coverage Report for Build 18528411984

Details

  • 118 of 118 (100.0%) changed or added relevant lines in 4 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.007%) to 97.964%

Totals Coverage Status
Change from base Build 18509542516: 0.007%
Covered Lines: 34299
Relevant Lines: 34833

💛 - Coveralls

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.

2 participants