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

data-headlessui-state on MenuItem #2796

Closed
JarvisH opened this issue Oct 11, 2023 · 3 comments
Closed

data-headlessui-state on MenuItem #2796

JarvisH opened this issue Oct 11, 2023 · 3 comments
Assignees

Comments

@JarvisH
Copy link

JarvisH commented Oct 11, 2023

What package within Headless UI are you using?

@headlessui/vue

What version of that package are you using?

v1.7.16

What browser are you using?

Chrome

Reproduction URL
See official example here: https://headlessui.com/vue/menu where it is not working.
Codesandbox: https://codesandbox.io/p/sandbox/interesting-hypatia-sjvd9z?file=%2Fsrc%2FApp.vue%3A4%2C23

Describe your issue

According to the section "Using data attributes" https://headlessui.com/vue/menu#using-data-attributes, <MenuItem /> should render with data-headlessui-state="active" when active. It does not.

From the documentation:

<!-- Rendered `MenuItems` -->
<ul data-headlessui-state="open">
  <li data-headlessui-state="">Account settings</li>
  <li data-headlessui-state="active">Support</li>
  <li data-headlessui-state="">License</li>
</ul>
@JarvisH
Copy link
Author

JarvisH commented Oct 11, 2023

I discovered this only works when rendering <MenuItem> via as="someElement".

<!-- Works -->
<MenuItem as="button">Test</MenuItem>

<!-- Does not work -->
<MenuItem><button>Test</button></MenuItem>

Codesandbox: https://codesandbox.io/p/sandbox/interesting-hypatia-sjvd9z?file=%2Fsrc%2FApp.vue%3A4%2C23

@JarvisH JarvisH closed this as completed Oct 11, 2023
@JarvisH JarvisH reopened this Oct 11, 2023
@JarvisH JarvisH changed the title data-headless-ui-state on MenuItem data-headlessui-state on MenuItem Oct 11, 2023
@JarvisH
Copy link
Author

JarvisH commented Oct 11, 2023

Is this a duplicate of #2787 ?

@RobinMalfait RobinMalfait self-assigned this Oct 11, 2023
@RobinMalfait
Copy link
Member

Hey!

Yep that's a duplicate of #2787, you can use the latest insiders version and this problem should go away:

npm install @headlessui/vue@insiders

Hope that helps!

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

No branches or pull requests

2 participants