-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[Bug]: Popover.Button emits type="button" even when the component isn't a button #619
Comments
What's the use case of setting the Popover.Button as an |
The button is inside the Popover.Panel, meant to close the popover and navigate to the next page. The popover is part of a app-level |
The Popover.Button is meant to be used as a toggle to open/close the panel and sit outside of it. It seems like you need to use the Link component directly instead.
|
That leaves the popover open after the user clicks on the link. The documentation points out that you can use Popover.Button inside the panel to close it. |
@MrLeebo this is the case but when having a
|
@maximegheraille that's why the repro is |
I have the same problem. Adding |
Have the same issue with
it still renders
which throws off the css styling |
Hey! Thank you for your bug report! This should be fixed, and will be available in the next release. You can already try it using:
|
What package within Headless UI are you using?
@headlessui/react
What version of that package are you using?
v1.1.0
What browser are you using?
Chrome
Reproduction repository
https://codesandbox.io/s/magical-bash-ij6dg
Describe your issue
Hello headlessui! 👋
This is a really minor issue, but I thought I'd do my due diligence and write it up.
Given this component:
The emitted HTML is:
However,
type="button"
is not an applicable property for an anchor tag. Ordinarily the extra prop is harmless, but under a perfect storm of unlikely circumstances, it can make a difference. For example, normalize.css uses it as a CSS selector:So this can cause the link to be styled like a button, for instance, in an older version of Chrome (v78). If you try to override the property by adding
type={null}
or something to the component, your prop is ignored.This is a really minor issue so I won't be offended if you think the best course is to just close it and move on, but I think that it would be better if Popover.Button only emitted
type="button"
when the component tag is the defaultas="button"
.The text was updated successfully, but these errors were encountered: