Skip to content

Commit

Permalink
validateDOMNesting: Allow hr as child of select (facebook#27632)
Browse files Browse the repository at this point in the history
fix facebook#27572

---------

Co-authored-by: Sophie Alpert <[email protected]>
  • Loading branch information
2 people authored and AndyPengc12 committed Apr 15, 2024
1 parent c1c26a3 commit 25bf50b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/react-dom-bindings/src/client/validateDOMNesting.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,12 @@ function isTagValidWithParent(tag: string, parentTag: ?string): boolean {
switch (parentTag) {
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inselect
case 'select':
return tag === 'option' || tag === 'optgroup' || tag === '#text';
return (
tag === 'hr' ||
tag === 'option' ||
tag === 'optgroup' ||
tag === '#text'
);
case 'optgroup':
return tag === 'option' || tag === '#text';
// Strictly speaking, seeing an <option> doesn't mean we're in a <select>
Expand Down

0 comments on commit 25bf50b

Please sign in to comment.