validateDOMNesting: Allow hr as child of select (#27632)

fix #27572

---------

Co-authored-by: Sophie Alpert <git@sophiebits.com>
This commit is contained in:
Sourabh singh
2023-10-31 14:43:16 -07:00
committed by GitHub
co-authored by Sophie Alpert
parent 0c6348758f
commit ca16c26356
@@ -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>