You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(COMPONENT): allow multiple instances of AriaDescriber #23499
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: cdk/a11yfeatureLabel used to distinguish feature request from other issues
Allow to have several AriaDescriber containers on a same page.
Today the container of AriaDescriber is necessarily appended to body, with an hardcoded id, and any pre-existing container is removed.
I see At least 3 different options to achieve this:
Do something similar to what's done in LiveAnnouncer: use an Injection token to inject the container.
Make the following constant customizable: MESSAGES_CONTAINER_ID . So that each instance of AriaDescriber can have his own container.
Do something similar to OverlayContainer so that the container can be moved somewhere else on the page, and stop relying on the ID the remove it
In all cases, the following const should be customizable: CDK_DESCRIBEDBY_ID_PREFIX, otherwise elements with duplicated ID will be created on the page.
Use Case
In the context of micro frontends, we may end up with 2 Angular Material instances on the same page.
Today, a second instance of AriaDescriber would remove the container of the first one, making it ineffective.
Looking through it, I think that it should mostly work already. The messagesContainer is a global variable which means that even if you ended up with multiple instances of the AriaDescriber, they'll all still use the same container.
That being said, I think that this will break down if the an AriaDescriber is destroyed while another one is still live, because we remove the global container in ngOnDestroy. It'll also break down one AriaDescriber is initialized later than another one, because the descriptions of the former will be removed by the latter. I think that these are somewhat edge cases, but they can definitely happen.
I think the way to go is to do something similar to the OverlayContainer. I'll look into it later today.
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: cdk/a11yfeatureLabel used to distinguish feature request from other issues
Activity
crisbeto commentedon Sep 1, 2021
Looking through it, I think that it should mostly work already. The
messagesContaineris a global variable which means that even if you ended up with multiple instances of theAriaDescriber, they'll all still use the same container.That being said, I think that this will break down if the an
AriaDescriberis destroyed while another one is still live, because we remove the global container inngOnDestroy. It'll also break down oneAriaDescriberis initialized later than another one, because the descriptions of the former will be removed by the latter. I think that these are somewhat edge cases, but they can definitely happen.I think the way to go is to do something similar to the
OverlayContainer. I'll look into it later today.fix(cdk/a11y): allow for multiple browser-generated description conta…
fix(cdk/a11y): allow for multiple browser-generated description conta…
fix(cdk/a11y): allow for multiple browser-generated description conta…
fix(cdk/a11y): allow for multiple browser-generated description conta…
fix(cdk/a11y): allow for multiple browser-generated description conta…
fix(cdk/a11y): allow for multiple browser-generated description conta…
angular-automatic-lock-bot commentedon Mar 3, 2022
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.
fix(cdk/a11y): allow for multiple browser-generated description conta…