Skip to content

Commit f99ec46

Browse files
authored
fix(Slider): add aria-label to thumb (#5313)
1 parent bb7df30 commit f99ec46

File tree

4 files changed

+41
-51
lines changed

4 files changed

+41
-51
lines changed

src/runtime/components/Slider.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,9 @@ function onChange(value: any) {
128128
disable-closing-trigger
129129
v-bind="(typeof tooltip === 'object' ? tooltip : {})"
130130
>
131-
<SliderThumb data-slot="thumb" :class="ui.thumb({ class: props.ui?.thumb })" />
131+
<SliderThumb data-slot="thumb" :class="ui.thumb({ class: props.ui?.thumb })" :aria-label="thumbs === 1 ? 'Thumb' : `Thumb ${thumb} of ${thumbs}`" />
132132
</UTooltip>
133-
<SliderThumb v-else data-slot="thumb" :class="ui.thumb({ class: props.ui?.thumb })" />
133+
<SliderThumb v-else data-slot="thumb" :class="ui.thumb({ class: props.ui?.thumb })" :aria-label="thumbs === 1 ? 'Thumb' : `Thumb ${thumb} of ${thumbs}`" />
134134
</template>
135135
</SliderRoot>
136136
</template>

test/components/Slider.spec.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,7 @@ describe('Slider', () => {
4141

4242
}
4343
})
44-
expect(await axe(wrapper.element, {
45-
rules: {
46-
// "ARIA input fields must have an accessible name (aria-input-field-name)"
47-
48-
// Fix any of the following:
49-
// aria-label attribute does not exist or is empty
50-
// aria-labelledby attribute does not exist, references elements that do not exist or references elements that are empty
51-
// Element has no title attribute
52-
'aria-input-field-name': { enabled: false }
53-
}
54-
})).toHaveNoViolations()
44+
expect(await axe(wrapper.element)).toHaveNoViolations()
5545
})
5646

5747
describe('emits', () => {

0 commit comments

Comments
 (0)