Skip to content
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ export const VAutocomplete = genericComponent<new <
},
})

const { menuId, ariaExpanded, ariaControls, ariaLabel } = useMenuActivator(props, menu)
const { ariaLabel } = useMenuActivator(props, menu)

const listRef = ref<VList>()
const listEvents = useScrolling(listRef, vTextFieldRef)
Expand Down Expand Up @@ -445,15 +445,12 @@ export const VAutocomplete = genericComponent<new <
onClick:clear={ onClear }
onMousedown:control={ onMousedownControl }
onKeydown={ onKeydown }
aria-expanded={ ariaExpanded.value }
aria-controls={ ariaControls.value }
>
{{
...slots,
default: () => (
<>
<VMenu
id={ menuId.value }
ref={ vMenuRef }
v-model={ menu.value }
activator="parent"
Expand Down
5 changes: 1 addition & 4 deletions packages/vuetify/src/components/VCombobox/VCombobox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ export const VCombobox = genericComponent<new <
},
})

const { menuId, ariaExpanded, ariaControls, ariaLabel } = useMenuActivator(props, menu)
const { ariaLabel } = useMenuActivator(props, menu)

watch(_search, value => {
if (cleared) {
Expand Down Expand Up @@ -496,15 +496,12 @@ export const VCombobox = genericComponent<new <
onClick:clear={ onClear }
onMousedown:control={ onMousedownControl }
onKeydown={ onKeydown }
aria-expanded={ ariaExpanded.value }
aria-controls={ ariaControls.value }
>
{{
...slots,
default: () => (
<>
<VMenu
id={ menuId.value }
ref={ vMenuRef }
v-model={ menu.value }
activator="parent"
Expand Down
6 changes: 4 additions & 2 deletions packages/vuetify/src/components/VOverlay/useActivator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,10 @@ function _useActivator (
function getActivator (selector = props.activator): HTMLElement | undefined {
const activator = getTarget(selector, vm)

// The activator should only be a valid element (Ignore comments and text nodes)
activatorEl.value = activator?.nodeType === Node.ELEMENT_NODE ? activator : undefined
activatorEl.value = activator?.querySelector('input[role="combobox"]') ??
(activator?.nodeType === Node.ELEMENT_NODE
? activator
: undefined)

return activatorEl.value
}
Expand Down
5 changes: 1 addition & 4 deletions packages/vuetify/src/components/VSelect/VSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ export const VSelect = genericComponent<new <
},
})

const { menuId, ariaExpanded, ariaControls, ariaLabel } = useMenuActivator(props, menu)
const { ariaLabel } = useMenuActivator(props, menu)

const computedMenuProps = computed(() => {
return {
Expand Down Expand Up @@ -411,8 +411,6 @@ export const VSelect = genericComponent<new <
onMousedown:control={ onMousedownControl }
onBlur={ onBlur }
onKeydown={ onKeydown }
aria-expanded={ ariaExpanded.value }
aria-controls={ ariaControls.value }
aria-label={ ariaLabel.value }
title={ ariaLabel.value }
>
Expand All @@ -421,7 +419,6 @@ export const VSelect = genericComponent<new <
default: () => (
<>
<VMenu
id={ menuId.value }
ref={ vMenuRef }
v-model={ menu.value }
activator="parent"
Expand Down
1 change: 0 additions & 1 deletion packages/vuetify/src/components/VTextField/VTextField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ export const VTextField = genericComponent<VTextFieldSlots>()({
onClick:clear={ (e: MouseEvent) => onClear(e, reset) }
onClick:prependInner={ props['onClick:prependInner'] }
onClick:appendInner={ props['onClick:appendInner'] }
role={ props.role }
{ ...omit(fieldProps, ['onClick:clear']) }
id={ id.value }
active={ isActive.value || isDirty.value }
Expand Down
14 changes: 2 additions & 12 deletions packages/vuetify/src/composables/menuActivator.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Utilities
import { computed, toRef, toValue, useId } from 'vue'
import { toRef, toValue } from 'vue'
import { propsFactory } from '@/util'

// Types
Expand Down Expand Up @@ -27,17 +27,7 @@ export const makeMenuActivatorProps = propsFactory({
export function useMenuActivator (props: MenuActivatorProps, isOpen: MaybeRefOrGetter<boolean>) {
const { t } = useLocale()

const uid = useId()
const menuId = computed(() => `menu-${uid}`)

const ariaExpanded = toRef(() => toValue(isOpen))
const ariaControls = toRef(() => menuId.value)
const ariaLabel = toRef(() => t(toValue(isOpen) ? props.closeText : props.openText))

return {
menuId,
ariaExpanded,
ariaControls,
ariaLabel,
}
return { ariaLabel }
}
Loading