Skip to content

Bug: 'Warning: validateDOMNesting: <hr> cannot appear as a child of <select>' – but this is now valid HTML #27572

@philwolstenholme

Description

@philwolstenholme

The latest version of Chrome and Safari support hr elements as children of select elements, and the HTML spec has been updated – but React warns about this as it used to be invalid HTML.

Screenshot of before and after with hr in select. The after image has dividers between groups.

React version: 18.2.0

Steps To Reproduce

  1. Add a hr element as a child of select

The current behavior

Warning: validateDOMNesting: <hr> cannot appear as a child of <select>

The expected behavior

No validateDOMNesting warning.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions