Skip to content
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

React Popover v2: warnings when used inside p-element #3319

Open
jmyrland opened this issue Jun 24, 2024 · 0 comments · May be fixed by #3362
Open

React Popover v2: warnings when used inside p-element #3319

jmyrland opened this issue Jun 24, 2024 · 0 comments · May be fixed by #3362
Assignees

Comments

@jmyrland
Copy link

What package within Headless UI are you using?

@headlessui/react

What version of that package are you using?

2.1.0

What browser are you using?

Chrome

Reproduction URL

See the sandbox

Describe your issue

When using Popover nested inside a p-element, the following warning is logged in the console:

Warning: validateDOMNesting(...): <div> cannot appear as a descendant of <p>.

As you can see in the sandbox, all of the popover components use as="span", but there is an empty div rendered within the Popover causing this issue:
image

Is this empty div-element critical for the popover to work, or is there a way to opt out from this element?

@RobinMalfait RobinMalfait self-assigned this Jul 4, 2024
RobinMalfait added a commit that referenced this issue Jul 4, 2024
This improves the HTML DOM tree if this happens to be used in let's say
a `p` tag where `div` elements are not allowed. The `Hidden` element is
hidden so it doesn't really matter what the underlying element is.

Fixes: #3319
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants