Skip to content
Open
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
2 changes: 1 addition & 1 deletion packages/vuetify/src/components/VMenu/VMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export const VMenu = genericComponent<OverlaySlots>()({
'aria-haspopup': 'menu',
'aria-expanded': String(isActive.value),
'aria-controls': id.value,
'aria-owns': id.value,
'data-v-overlay-activator': id.value,
onKeydown: onActivatorKeydown,
}, props.activatorProps)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,22 @@ import { commands, render, screen, userEvent, wait } from '@test'
import { ref } from 'vue'

describe('VMenu', () => {
it('should associate the activator with the menu using aria-controls', () => {
render(() => (
<VMenu>
{{
activator: ({ props }: any) => <VBtn { ...props } data-testid="activator">Menu</VBtn>,
default: () => <VListItem title="Item" />,
}}
</VMenu>
))

const activator = screen.getByTestId('activator')

expect(activator.getAttribute('aria-controls')).toMatch(/^v-menu-v-\d+$/)
expect(activator).not.toHaveAttribute('aria-owns')
})

describe('open-on-focus with template activator', () => {
beforeEach(() => commands.setFocusEmulationDisabled())

Expand Down
Loading