-
Notifications
You must be signed in to change notification settings - Fork 6.8k
refactor: add optional random infix to generated id #32173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/cdk/a11y/id-generator.ts
Outdated
| } | ||
|
|
||
| return `${prefix}${counters[prefix]++}`; | ||
| return `${prefix}${randomInfix ? this._infix + '-' : ''}${counters[prefix]++}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
super nit: I'm wondering if we should add the random number as a suffix. I remember that back in the day IDs starting with a number were problematic and in theory the prefix here can be an empty string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the prefix is an empty string then starting with the counter is going to have the same problem. Maybe we can add a letter to the random number like a1234?
e4ce50e to
f2ef0e9
Compare
|
Updated API golden. |
f2ef0e9 to
6271738
Compare
6271738 to
6a9cc78
Compare
Or do we want to create a different id generator only used by aria?