feat(Rate): improve a11y when disabled or readonly (#9881)

This commit is contained in:
neverland 2021-11-16 19:34:48 +08:00 committed by GitHub
parent a6df789488
commit ec2ff59270
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 28 additions and 0 deletions

View File

@ -15,6 +15,8 @@ exports[`should render demo and match snapshot 1`] = `
<div role="radiogroup"
class="van-rate"
tabindex="0"
aria-disabled="false"
aria-readonly="false"
>
<div role="radio"
class="van-rate__item"
@ -131,6 +133,8 @@ exports[`should render demo and match snapshot 1`] = `
<div role="radiogroup"
class="van-rate"
tabindex="0"
aria-disabled="false"
aria-readonly="false"
>
<div role="radio"
class="van-rate__item"

View File

@ -308,6 +308,8 @@ exports[`should render demo and match snapshot 1`] = `
<div role="radiogroup"
class="van-rate"
tabindex="0"
aria-disabled="false"
aria-readonly="false"
>
<div role="radio"
class="van-rate__item"

View File

@ -232,6 +232,8 @@ export default defineComponent({
disabled: props.disabled,
})}
tabindex={props.disabled ? undefined : 0}
aria-disabled={props.disabled}
aria-readonly={props.readonly}
onTouchstart={onTouchStart}
onTouchmove={onTouchMove}
>

View File

@ -5,6 +5,8 @@ exports[`should render demo and match snapshot 1`] = `
<div role="radiogroup"
class="van-rate"
tabindex="0"
aria-disabled="false"
aria-readonly="false"
>
<div role="radio"
class="van-rate__item"
@ -62,6 +64,8 @@ exports[`should render demo and match snapshot 1`] = `
<div role="radiogroup"
class="van-rate"
tabindex="0"
aria-disabled="false"
aria-readonly="false"
>
<div role="radio"
class="van-rate__item"
@ -119,6 +123,8 @@ exports[`should render demo and match snapshot 1`] = `
<div role="radiogroup"
class="van-rate"
tabindex="0"
aria-disabled="false"
aria-readonly="false"
>
<div role="radio"
class="van-rate__item"
@ -186,6 +192,8 @@ exports[`should render demo and match snapshot 1`] = `
<div role="radiogroup"
class="van-rate"
tabindex="0"
aria-disabled="false"
aria-readonly="false"
>
<div role="radio"
class="van-rate__item"
@ -247,6 +255,8 @@ exports[`should render demo and match snapshot 1`] = `
<div role="radiogroup"
class="van-rate"
tabindex="0"
aria-disabled="false"
aria-readonly="false"
>
<div role="radio"
class="van-rate__item"
@ -313,6 +323,8 @@ exports[`should render demo and match snapshot 1`] = `
<div>
<div role="radiogroup"
class="van-rate van-rate--disabled"
aria-disabled="true"
aria-readonly="false"
>
<div role="radio"
class="van-rate__item"
@ -365,6 +377,8 @@ exports[`should render demo and match snapshot 1`] = `
<div role="radiogroup"
class="van-rate van-rate--readonly"
tabindex="0"
aria-disabled="false"
aria-readonly="true"
>
<div role="radio"
class="van-rate__item"
@ -422,6 +436,8 @@ exports[`should render demo and match snapshot 1`] = `
<div role="radiogroup"
class="van-rate van-rate--readonly"
tabindex="0"
aria-disabled="false"
aria-readonly="true"
>
<div role="radio"
class="van-rate__item"
@ -483,6 +499,8 @@ exports[`should render demo and match snapshot 1`] = `
<div role="radiogroup"
class="van-rate"
tabindex="0"
aria-disabled="false"
aria-readonly="false"
>
<div role="radio"
class="van-rate__item"

View File

@ -4,6 +4,8 @@ exports[`should render gutter when using gutter prop 1`] = `
<div role="radiogroup"
class="van-rate"
tabindex="0"
aria-disabled="false"
aria-readonly="false"
>
<div role="radio"
style="padding-right: 10px;"