Skip to content

Conversation

@josepharhar
Copy link
Contributor

Summary

The HTML spec was updated to remove most special parsing rules for select elements: whatwg/html#10548

Chrome shipped these parser changes a while ago, and they have been implemented behind a flag in WebKit.

This PR updates the logic in validateDOMNesting to match the new HTML spec so that authors can use the new parsing rules without getting errors in React.

Fixes #33609

How did you test this change?

I updated the test cases in validateDOMNesting-test.js

The HTML spec was updated to remove most special parsing rules for
select elements. This PR updates the logic in validateDOMNesting to
match the new HTML spec so that authors can use the new parsing rules
without getting errors in React.

Fixes facebook#33609
@react-sizebot
Copy link

The size diff is too large to display in a single comment. The GitHub action for this pull request contains an artifact called 'sizebot-message.md' with the full message.

Generated by 🚫 dangerJS against 55aa9b2

@josepharhar
Copy link
Contributor Author

@sebmarkbage could you review this or help me get this reviewed?

@sebmarkbage
Copy link
Collaborator

sebmarkbage commented Nov 4, 2025

The main purpose of the validation in validateDOMNesting.js is to provide a nicer reason for why something later goes wrong when there's a hydration error due to the parsing not lining up with React's expectations. The later error can't directly be attributed to this as a cause.

It's a development time error so that you don't end up having to deduce later from production errors what might have gone wrong.

It's also an error even for client updates/navigations, even if you're not SSR:ing so that your component is resilient to being SSR:ed in the future, on a different page or if you happen to refresh the current page. It provides consistency in the ecosystem even in specific scenarios where it doesn't really come into play.

If you're developing in Chrome but deploying to production to users in Safari, it's still important to see this error in development even in Chrome. So I don't think we can take this as is until the fix is more widely distributed and enabled everywhere.

@josepharhar
Copy link
Contributor Author

Thanks. So once the parser changes are shipped in Firefox and Safari then we can merge this?

I wonder if it would be worth tweaking the message to show that its valid in some browsers but not others yet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: validateDOMNesting needs to be updated for new customisable form widgets

3 participants