Skip to content

Only use latin1 characters in useId algorithm #33421

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

Closed
wants to merge 1 commit into from

Conversation

eps1lon
Copy link
Collaborator

@eps1lon eps1lon commented Jun 3, 2025

Summary

Closes #33410

: as a delimiter produced invalid CSS selectors. «» are not valid XML 1.0 names. _ should be valid in all scenarios. The Root still has an identifierPrefix option if that causes conflicts.

How did you test this change?

Search&replace for «, », \u00AB, and \u00BB

@eps1lon eps1lon requested a review from sebmarkbage June 3, 2025 14:32
@github-actions github-actions bot added the React Core Team Opened by a member of the React Core Team label Jun 3, 2025
@react-sizebot
Copy link

Comparing: 2b4064e...f48056c

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.js = 6.68 kB 6.68 kB +0.05% 1.83 kB 1.83 kB
oss-stable/react-dom/cjs/react-dom-client.production.js = 529.84 kB 529.82 kB = 93.52 kB 93.51 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.69 kB 6.69 kB +0.05% 1.83 kB 1.83 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js = 650.94 kB 650.91 kB = 114.65 kB 114.63 kB
facebook-www/ReactDOM-prod.classic.js = 675.89 kB 675.86 kB = 118.93 kB 118.91 kB
facebook-www/ReactDOM-prod.modern.js = 666.17 kB 666.14 kB = 117.32 kB 117.30 kB

Significant size changes

Includes any change greater than 0.2%:

(No significant changes)

Generated by 🚫 dangerJS against f48056c

@eps1lon
Copy link
Collaborator Author

eps1lon commented Jun 3, 2025

Closing in favor of #33422

@eps1lon eps1lon closed this Jun 3, 2025
@eps1lon eps1lon deleted the sebbie/useidlatine1 branch June 3, 2025 14:42
sebmarkbage added a commit that referenced this pull request Jun 3, 2025
Alternative to #33421. The difference is that this also adds an
underscore between the "R" and the ID.

The reason we wanted to use special characters is because we use the
full spectrum of A-Z 0-9 in our ID generation so we can basically
collide with any common word (or anyone using a similar algorithm,
base64 or even base16). It's a little less likely that someone would put
`_R_` specifically unless you generate like two IDs separated by
underscore.


![9w2ogt](https://github.com/user-attachments/assets/21b2d2ac-1a3a-4657-ba0b-1616e49dfdee)
github-actions bot pushed a commit that referenced this pull request Jun 3, 2025
Alternative to #33421. The difference is that this also adds an
underscore between the "R" and the ID.

The reason we wanted to use special characters is because we use the
full spectrum of A-Z 0-9 in our ID generation so we can basically
collide with any common word (or anyone using a similar algorithm,
base64 or even base16). It's a little less likely that someone would put
`_R_` specifically unless you generate like two IDs separated by
underscore.

![9w2ogt](https://github.com/user-attachments/assets/21b2d2ac-1a3a-4657-ba0b-1616e49dfdee)

DiffTrain build for [1ae0a84](1ae0a84)
github-actions bot pushed a commit that referenced this pull request Jun 3, 2025
Alternative to #33421. The difference is that this also adds an
underscore between the "R" and the ID.

The reason we wanted to use special characters is because we use the
full spectrum of A-Z 0-9 in our ID generation so we can basically
collide with any common word (or anyone using a similar algorithm,
base64 or even base16). It's a little less likely that someone would put
`_R_` specifically unless you generate like two IDs separated by
underscore.

![9w2ogt](https://github.com/user-attachments/assets/21b2d2ac-1a3a-4657-ba0b-1616e49dfdee)

DiffTrain build for [1ae0a84](1ae0a84)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed React Core Team Opened by a member of the React Core Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: useId generates invalid ids for SVG elements.
3 participants