feat(Stepper): add aria-disabled for a11y (#9877)

This commit is contained in:
neverland 2021-11-16 17:41:29 +08:00 committed by GitHub
parent 35fa1492c3
commit e2a4f091ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 0 deletions

View File

@ -276,6 +276,7 @@ exports[`should render demo and match snapshot 1`] = `
>
<button type="button"
class="van-stepper__minus van-stepper__minus--disabled"
aria-disabled="true"
>
</button>
<input type="text"

View File

@ -297,6 +297,7 @@ export default defineComponent({
bem('minus', { disabled: minusDisabled.value }),
{ [HAPTICS_FEEDBACK]: !minusDisabled.value },
]}
aria-disabled={minusDisabled.value || undefined}
{...createListeners('minus')}
/>
<input
@ -328,6 +329,7 @@ export default defineComponent({
bem('plus', { disabled: plusDisabled.value }),
{ [HAPTICS_FEEDBACK]: !plusDisabled.value },
]}
aria-disabled={plusDisabled.value || undefined}
{...createListeners('plus')}
/>
</div>

View File

@ -14,6 +14,7 @@ exports[`should render demo and match snapshot 1`] = `
>
<button type="button"
class="van-stepper__minus van-stepper__minus--disabled"
aria-disabled="true"
>
</button>
<input type="text"
@ -43,6 +44,7 @@ exports[`should render demo and match snapshot 1`] = `
>
<button type="button"
class="van-stepper__minus van-stepper__minus--disabled"
aria-disabled="true"
>
</button>
<input type="text"
@ -72,6 +74,7 @@ exports[`should render demo and match snapshot 1`] = `
>
<button type="button"
class="van-stepper__minus van-stepper__minus--disabled"
aria-disabled="true"
>
</button>
<input type="text"
@ -101,6 +104,7 @@ exports[`should render demo and match snapshot 1`] = `
>
<button type="button"
class="van-stepper__minus van-stepper__minus--disabled"
aria-disabled="true"
>
</button>
<input type="tel"
@ -130,6 +134,7 @@ exports[`should render demo and match snapshot 1`] = `
>
<button type="button"
class="van-stepper__minus van-stepper__minus--disabled"
aria-disabled="true"
>
</button>
<input type="text"
@ -143,6 +148,7 @@ exports[`should render demo and match snapshot 1`] = `
>
<button type="button"
class="van-stepper__plus van-stepper__plus--disabled"
aria-disabled="true"
>
</button>
</div>
@ -160,6 +166,7 @@ exports[`should render demo and match snapshot 1`] = `
>
<button type="button"
class="van-stepper__minus van-stepper__minus--disabled"
aria-disabled="true"
>
</button>
<input type="text"
@ -190,6 +197,7 @@ exports[`should render demo and match snapshot 1`] = `
>
<button type="button"
class="van-stepper__minus van-stepper__minus--disabled"
aria-disabled="true"
>
</button>
<input type="text"
@ -220,6 +228,7 @@ exports[`should render demo and match snapshot 1`] = `
<button type="button"
style="width: 32px; height: 32px;"
class="van-stepper__minus van-stepper__minus--disabled"
aria-disabled="true"
>
</button>
<input type="text"
@ -251,6 +260,7 @@ exports[`should render demo and match snapshot 1`] = `
>
<button type="button"
class="van-stepper__minus van-stepper__minus--disabled"
aria-disabled="true"
>
</button>
<input type="text"
@ -281,6 +291,7 @@ exports[`should render demo and match snapshot 1`] = `
<button type="button"
style="width: 22px; height: 22px;"
class="van-stepper__minus van-stepper__minus--disabled"
aria-disabled="true"
>
</button>
<input type="text"

View File

@ -6,6 +6,7 @@ exports[`should disable buttons and input when using disabled prop 1`] = `
>
<button type="button"
class="van-stepper__minus van-stepper__minus--disabled"
aria-disabled="true"
>
</button>
<input type="text"
@ -19,6 +20,7 @@ exports[`should disable buttons and input when using disabled prop 1`] = `
>
<button type="button"
class="van-stepper__plus van-stepper__plus--disabled"
aria-disabled="true"
>
</button>
</div>
@ -31,6 +33,7 @@ exports[`should update input height and button size when using button-size prop
<button type="button"
style="width: 2rem; height: 2rem;"
class="van-stepper__minus van-stepper__minus--disabled"
aria-disabled="true"
>
</button>
<input type="text"