icon: multiple SVGs on a page should have unique IDs #11395
Comments
Re-opening this as the id mangling in #11342 is not the same as the lack of id caching in this issue. |
This has been a problem since id caching was first implemented in @EmielH (#11465 (comment)) found that all of the icons loaded on the initial page load are loaded without caching. Caching then starts after the page load has been completed. |
From
This solution solved the regression and in some cases fixed the accessibility issue. However, it did not resolve all of the a11y issues as this issue demonstrates. |
<!-- Filling out this template is required! Do not delete it when submitting a Pull Request! Without this information, your Pull Request may be auto-closed. --> ## PR Checklist Please check that your PR fulfills the following requirements: - [X] The commit message follows [our guidelines](https://github.com/angular/material/blob/master/.github/CONTRIBUTING.md#-commit-message-format) - [X] Tests for the changes have been added or this is not a bug fix / enhancement - [X] Docs have been added, updated, or were not required ## PR Type What kind of change does this PR introduce? <!-- Please check the one that applies to this PR using "x". --> ``` [X] Bugfix [ ] Enhancement [ ] Documentation content changes [ ] Code style update (formatting, local variables) [ ] Refactoring (no functional changes, no api changes) [ ] Build related changes [ ] CI related changes [ ] Infrastructure changes [ ] Other... Please describe: ``` ## What is the current behavior? <!-- Please describe the current behavior that you are modifying and link to one or more relevant issues. --> When the same icon is used multiple times, they all have the same id. Issue Number: Fixes #11395. This fixes the issue found by @coennijhuis in PR #11342. ## What is the new behavior? When the same icon is used multiple times, they all have a different id. `_cache` followed by a number is appended to the id. ## Does this PR introduce a breaking change? ``` [ ] Yes [X] No ``` <!-- If this PR contains a breaking change, please describe the impact and migration path for existing applications below. --> <!-- Note that breaking changes are highly unlikely to get merged to master unless the validation is clear and the use case is critical. --> ## Other information
BUG:
When adding multiple identical SVGs to a page, they should all have unique IDs.
CodePen and steps to reproduce the issue:
CodePen link: https://codepen.io/anon/pen/jpxBZx
Issue: All IDs for the icons are the same
Detailed Reproduction Steps:
What is the expected behavior?
The expected behavior is that all the IDs in the tags are unique.
What is the current behavior?
The current behavior is that the IDs are all the same
What is the use-case or motivation for changing an existing behavior?
Accessibility standards state that an ID should only be used once in page. (WCAG)
Which versions of AngularJS, Material, OS, and browsers are affected?
Is there anything else we should know? Stack Traces, Screenshots, etc.
NA
The text was updated successfully, but these errors were encountered: