-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Description
Is this a regression?
- Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
No response
Description
The Tooltip component (and others like SortHeader, Badge) uses the CDK AriaDescriber service for a11y. The AriaDescriber service creates a new hidden element with a unique id and the tooltip text, appends it to the body and creates a reference on the tooltip element with aria-describedby
.
The unique id for the hidden element is generated using counter variable (cdk-describedby-message-1, cdk-describedby-message-2, ...). In a microfrontend with multiple Angular versions on the page this results in elements with an id that is not unique. This results in wrong descriptions.
Reproduction
Steps to reproduce:
- Open https://material.angular.io/components/tooltip/overview
- Inspect the "Action" button in the first example
- Open the "Accessibility" tab in the inspector and scroll to the "Description" property
Expected Behavior
The description should be "Info about the action".
The id should be unique in a microfrontend with multiple Angular versions.
Actual Behavior
The description is "Select a version of the documentation".
This is because aria-describedby is set to cdk-describedby-message-1
.
If you scroll to the end in the Elements Tab you can see that there are two elements with class cdk-describedby-message-container
and they contain elements with the same id.
Environment
- Angular: 13.0.3
- CDK/Material: 13.3.7
- Browser(s): Brave
- Operating System (e.g. Windows, macOS, Ubuntu): macOS