Skip to content

Commit

Permalink
fix: add missing aria-disabled on the whole slider when disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
ExFlo authored and quentinderoubaix committed Feb 14, 2024
1 parent 6affbb1 commit 5379579
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions angular/lib/src/components/slider/slider.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {take} from 'rxjs';
class: `au-slider`,
'[class]': '(state().vertical ? "au-slider-vertical" : "au-slider-horizontal") + " " + state().className',
'[class.disabled]': 'state().disabled',
'[attr.aria-disabled]': 'state().disabled ? true : null',
'(blur)': 'handleBlur()',
},
template: `
Expand Down
3 changes: 0 additions & 3 deletions e2e/demo.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ const allRoutes = globSync(`**/+page.svelte`, {cwd: pathToFrameworkDir}).flatMap

async function analyze(page: Page, route: string): Promise<AxeResults> {
const analyser = new AxeBuilder({page}).withTags(['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa']);
if (route.includes('slider')) {
analyser.disableRules('color-contrast');
}
return analyser.analyze();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ <h2>
"Disabled slider"
</h2>
<div
aria-disabled="true"
class="au-slider au-slider-horizontal disabled"
>
<div
Expand Down
1 change: 1 addition & 0 deletions react/lib/src/components/slider/slider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export function Slider(props: Partial<SliderProps>) {
<div
ref={sliderSetRef}
className={`au-slider ${vertical ? 'au-slider-vertical' : 'au-slider-horizontal'} ${className} ${disabled ? ' disabled' : ''}`}
aria-disabled={disabled ? 'true' : undefined}
>
{progressDisplayOptions.map((option, index) => (
<div
Expand Down
7 changes: 6 additions & 1 deletion svelte/lib/src/components/slider/Slider.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,12 @@
</script>

<!-- on:blur={onTouched} ?? -->
<div use:sliderDirective class={`au-slider ${$vertical$ ? 'au-slider-vertical' : 'au-slider-horizontal'} ${$className$}`} class:disabled={$disabled$}>
<div
use:sliderDirective
class={`au-slider ${$vertical$ ? 'au-slider-vertical' : 'au-slider-horizontal'} ${$className$}`}
class:disabled={$disabled$}
aria-disabled={$disabled$ ? true : null}
>
{#each $progressDisplayOptions$ as option}
<div
class="au-slider-progress"
Expand Down

0 comments on commit 5379579

Please sign in to comment.