Skip to content

Commit

Permalink
fix(Select): set id attribute on
Browse files Browse the repository at this point in the history
  • Loading branch information
romhml committed Jan 17, 2025
1 parent 7906683 commit 4936589
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/runtime/components/Select.vue
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ const emits = defineEmits<SelectEmits<T, V, M>>()
const slots = defineSlots<SelectSlots<T, M>>()
const appConfig = useAppConfig()
const rootProps = useForwardPropsEmits(reactivePick(props, 'modelValue', 'defaultValue', 'open', 'defaultOpen', 'disabled', 'autocomplete', 'required', 'multiple'), emits)
const rootProps = useForwardPropsEmits(reactivePick(props, 'open', 'defaultOpen', 'disabled', 'autocomplete', 'required', 'multiple'), emits)
const contentProps = toRef(() => defu(props.content, { side: 'bottom', sideOffset: 8, collisionPadding: 8, position: 'popper' }) as SelectContentProps)
const arrowProps = toRef(() => props.arrow as SelectArrowProps)
Expand Down Expand Up @@ -186,16 +186,17 @@ function onUpdateOpen(value: boolean) {
<!-- eslint-disable vue/no-template-shadow -->
<template>
<SelectRoot
:id="id"
v-slot="{ modelValue, open }"
v-bind="rootProps"
:name="name"
v-bind="rootProps"
:autocomplete="autocomplete"
:disabled="disabled"
:default-value="defaultValue as AcceptableValue | AcceptableValue[] | undefined"

Check failure on line 194 in src/runtime/components/Select.vue

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 22)

Filters are deprecated
:model-value="modelValue as AcceptableValue | AcceptableValue[] | undefined"

Check failure on line 195 in src/runtime/components/Select.vue

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 22)

Filters are deprecated
@update:model-value="onUpdate"
@update:open="onUpdateOpen"
>
<SelectTrigger :class="ui.base({ class: [props.class, props.ui?.base] })" v-bind="ariaAttrs">
<SelectTrigger :id="id" :class="ui.base({ class: [props.class, props.ui?.base] })" v-bind="ariaAttrs">
<span v-if="isLeading || !!avatar || !!slots.leading" :class="ui.leading({ class: props.ui?.leading })">
<slot name="leading" :model-value="(modelValue as M extends true ? AcceptableValue[] : AcceptableValue)" :open="open" :ui="ui">
<UIcon v-if="isLeading && leadingIconName" :name="leadingIconName" :class="ui.leadingIcon({ class: props.ui?.leadingIcon })" />
Expand Down
2 changes: 2 additions & 0 deletions src/runtime/composables/useFormField.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ export function useFormField<T>(props?: Props<T>, opts?: { bind?: boolean, defer
emitFormInput,
emitFormChange,
ariaAttrs: computed(() => {
if (!formField?.value) return

const descriptiveAttrs = ['error' as const, 'hint' as const, 'description' as const]
.filter(type => formField?.value?.[type])
.map(type => `${formField?.value.ariaId}-${type}`) || []
Expand Down

0 comments on commit 4936589

Please sign in to comment.