Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .changeset/fix-select-combobox-item-double-role-738.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
"@vuetify/v0": patch
---

fix(Select, Combobox): correct the documented Item example to avoid double `role="option"` (#738)

`Select.Item` and `Combobox.Item` already bind their full `attrs` bundle (including
`role="option"`) onto their own non-renderless `Atom`. Both components' `@example`
JSDoc then spread that same `attrs` object onto a child `<div>` inside the default
slot — which `.claude/rules/components.md` documents as unsupported outside
`renderless` mode: it renders `role="option"` twice (`listbox > div[role="option"] >
div[role="option"]`, failing axe's `aria-required-parent`) and double-fires every
handler in `attrs`, once on the child and again via bubbling to the Atom.

Added `renderless` to the documented `Select.Item` / `Combobox.Item` usage in both
components' `@example` blocks, so the consumer's own element is the only one
rendered — matching how `packages/0/src/components/fixtures/Select.vue` and
`Combobox.vue` (and every real docs example) already use these components.
3 changes: 2 additions & 1 deletion packages/0/src/components/Combobox/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ import Root from './ComboboxRoot.vue'
* :key="item.id"
* :id="item.id"
* :value="item.label"
* renderless
* v-slot="{ isSelected, attrs }"
* >
* <div v-bind="attrs">{{ item.label }}</div>
Expand Down Expand Up @@ -171,7 +172,7 @@ export const Combobox = {
*
* @example
* ```vue
* <Combobox.Item id="apple" value="Apple" v-slot="{ isSelected, isHighlighted, attrs }">
* <Combobox.Item id="apple" value="Apple" renderless v-slot="{ isSelected, isHighlighted, attrs }">
* <div v-bind="attrs" :class="{ highlighted: isHighlighted }">
* Apple {{ isSelected ? '✓' : '' }}
* </div>
Expand Down
3 changes: 2 additions & 1 deletion packages/0/src/components/Select/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ import Value from './SelectValue.vue'
* :key="item.id"
* :id="item.id"
* :value="item.label"
* renderless
* v-slot="{ isSelected, attrs }"
* >
* <div v-bind="attrs">{{ item.label }}</div>
Expand Down Expand Up @@ -183,7 +184,7 @@ export const Select = {
* </script>
*
* <template>
* <Select.Item id="apple" value="Apple" v-slot="{ isSelected, attrs }">
* <Select.Item id="apple" value="Apple" renderless v-slot="{ isSelected, attrs }">
* <div v-bind="attrs">Apple {{ isSelected ? '✓' : '' }}</div>
* </Select.Item>
* </template>
Expand Down
Loading