Skip to content
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

Use uniqueId for recurring title and desc #244

Merged
merged 1 commit into from
Nov 29, 2022

Conversation

mrloop
Copy link
Contributor

@mrloop mrloop commented Nov 28, 2022

The current implementation uses guidFor this will cache ids and reuse them if the same value is passed to guidFor, see https://github.com/emberjs/ember.js/blob/4e3300bdfe75da14f9714b6b1539dbd1612c5af2/packages/%40ember/-internals/utils/lib/guid.ts#L97

The ids in a HTML document should be unique. However if a title or desc is reused, for example you have a recurring element, then svg-jar generates ids which match for the recurring element.

This commit uses the uniqueId function from the unique-id helper to generate a unique id regardless of the svg-jar title or desc matching previous svg-jar.

Unfortunately uniqueId is not exported so it is copy and pasted. In the future it will be possible to import it, see emberjs/ember.js#20165

Fixes #243

The current implementation uses `guidFor` this will cache ids and reuse
them if the same value is passed to `guidFor`, see
https://github.com/emberjs/ember.js/blob/4e3300bdfe75da14f9714b6b1539dbd1612c5af2/packages/%40ember/-internals/utils/lib/guid.ts#L97

The ids in a HTML document should be unique. However if a `title` or
`desc` is reused, for example you have a recurring element, then
`svg-jar` generates ids which match for the recurring element.

This commit uses the `uniqueId` function from the `unique-id` helper
to generate a unique id regardless of the `svg-jar` `title` or `desc`
matching previous `svg-jar`.

Unfortunately `uniqueId` is not exported so it is copy and pasted.
In the future it will be possible to import it, see
emberjs/ember.js#20165

Fixes evoactivity#243
@nicolasgasco
Copy link

Thanks for this MR @mrloop ! It is a good fix to the Issue a logged some time ago. Hope it will be reviewed and merged soon!

@jherdman jherdman merged commit e4aee21 into evoactivity:master Nov 29, 2022
@jherdman
Copy link
Collaborator

Many thanks!

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.

Screen reader reading the wrong title when several svg-jars are used in the same page
3 participants