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
6 changes: 3 additions & 3 deletions src/runtime/components/Slider.vue
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function onChange(value: any) {

<template>
<SliderRoot
v-bind="{ ...rootProps, ...ariaAttrs }"
v-bind="rootProps"
:id="id"
v-model="sliderValue"
:name="name"
Expand All @@ -133,9 +133,9 @@ function onChange(value: any) {
disable-closing-trigger
v-bind="(typeof props.tooltip === 'object' ? props.tooltip : {})"
>
<SliderThumb data-slot="thumb" :class="ui.thumb({ class: props.ui?.thumb })" :aria-label="thumbs === 1 ? 'Thumb' : `Thumb ${thumb} of ${thumbs}`" />
<SliderThumb data-slot="thumb" :class="ui.thumb({ class: props.ui?.thumb })" :aria-label="thumbs === 1 ? 'Thumb' : `Thumb ${thumb} of ${thumbs}`" v-bind="ariaAttrs" />
</UTooltip>
<SliderThumb v-else data-slot="thumb" :class="ui.thumb({ class: props.ui?.thumb })" :aria-label="thumbs === 1 ? 'Thumb' : `Thumb ${thumb} of ${thumbs}`" />
<SliderThumb v-else data-slot="thumb" :class="ui.thumb({ class: props.ui?.thumb })" :aria-label="thumbs === 1 ? 'Thumb' : `Thumb ${thumb} of ${thumbs}`" v-bind="ariaAttrs" />
</template>
</SliderRoot>
</template>
14 changes: 14 additions & 0 deletions test/components/FormField.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,20 @@ describe('FormField', () => {
})
}

if (name === 'Slider') {
test('binds aria attributes on the thumb', async () => {
const wrapper = await renderFormField({
props: { error: 'Error' },
inputComponent
})

const invalid = wrapper.findAll('[aria-invalid="true"]')
expect(invalid).toHaveLength(1)
expect(invalid[0]!.attributes('role')).toBe('slider')
expect(invalid[0]!.attributes('aria-describedby')).toBe('v-0-0-error')
})
}

test('binds hints with aria-describedby', async () => {
const wrapper = await renderFormField({
props: { hint: 'somehint' },
Expand Down
Loading