Compare commits

...

3 Commits

Author SHA1 Message Date
neverland
8214bf8d02
feat(Popover): add tabindex and aria-disabled for a11y (#9889) 2021-11-17 16:57:47 +08:00
neverland
5f7e65b637
feat(List): add role and tabindex for a11y (#9888) 2021-11-17 16:31:00 +08:00
neverland
0dd93a0032
feat(Switch): add tabindex for a11y (#9887) 2021-11-17 16:07:07 +08:00
15 changed files with 33 additions and 9 deletions

View File

@ -117,6 +117,7 @@ exports[`should render demo and match snapshot 1`] = `
<div role="switch"
class="van-switch"
style="font-size: 24px;"
tabindex="0"
aria-checked="false"
>
<div class="van-switch__node">

View File

@ -222,6 +222,7 @@ exports[`should render AddressEdit with props correctly 1`] = `
<div role="switch"
class="van-switch van-switch--on"
style="font-size: 24px;"
tabindex="0"
aria-checked="true"
>
<div class="van-switch__node">

View File

@ -52,6 +52,7 @@ exports[`should render demo and match snapshot 1`] = `
<div role="switch"
class="van-switch"
style="font-size: 24px;"
tabindex="0"
aria-checked="false"
>
<div class="van-switch__node">

View File

@ -172,6 +172,7 @@ exports[`should render demo and match snapshot 1`] = `
<div role="switch"
class="van-switch"
style="font-size: 20px;"
tabindex="0"
aria-checked="false"
>
<div class="van-switch__node">

View File

@ -115,7 +115,12 @@ export default defineComponent({
const text = slots.error ? slots.error() : props.errorText;
if (text) {
return (
<div class={bem('error-text')} onClick={clickErrorText}>
<div
role="button"
class={bem('error-text')}
tabindex={0}
onClick={clickErrorText}
>
{text}
</div>
);

View File

@ -5,7 +5,10 @@ exports[`should render error slot correctly 1`] = `
class="van-list"
aria-busy="false"
>
<div class="van-list__error-text">
<div role="button"
class="van-list__error-text"
tabindex="0"
>
Custom Error
</div>
<div class="van-list__placeholder">

View File

@ -173,6 +173,8 @@ export default defineComponent({
role="menuitem"
class={[bem('action', { disabled, 'with-icon': icon }), className]}
style={{ color }}
tabindex={disabled ? undefined : 0}
aria-disabled={disabled || undefined}
onClick={() => onClickAction(action, index)}
>
{icon && (

View File

@ -3,6 +3,7 @@
exports[`should allow to custom the className of action 1`] = `
<div role="menuitem"
class="van-popover__action foo"
tabindex="0"
>
<div class="van-popover__action-text van-hairline--bottom">
Option
@ -22,6 +23,7 @@ exports[`should change icon class prefix when using icon-prefix prop 1`] = `
>
<div role="menuitem"
class="van-popover__action van-popover__action--with-icon"
tabindex="0"
>
<i class="van-badge__wrapper my-icon my-icon-success van-popover__action-icon">
</i>

View File

@ -196,7 +196,7 @@ export default defineComponent({
style={style}
class={bem('item')}
tabindex={disabled ? undefined : 0}
aria-setsize={+count}
aria-setsize={count}
aria-posinset={score}
aria-checked={!isVoid}
onClick={onClickItem}

View File

@ -47,6 +47,7 @@ exports[`should render demo and match snapshot 1`] = `
<div role="switch"
class="van-switch"
style="font-size: 24px;"
tabindex="0"
aria-checked="false"
>
<div class="van-switch__node">

View File

@ -295,9 +295,9 @@ export default defineComponent({
role="slider"
class={getButtonClassName(index)}
tabindex={props.disabled ? undefined : 0}
aria-valuemin={+props.min}
aria-valuemin={props.min}
aria-valuenow={current}
aria-valuemax={+props.max}
aria-valuemax={props.max}
aria-disabled={props.disabled || undefined}
aria-readonly={props.readonly || undefined}
aria-orientation={props.vertical ? 'vertical' : 'horizontal'}

View File

@ -313,9 +313,9 @@ export default defineComponent({
// set keyboard in modern browsers
inputmode={props.integer ? 'numeric' : 'decimal'}
placeholder={props.placeholder}
aria-valuemax={+props.max}
aria-valuemin={+props.min}
aria-valuenow={+current.value}
aria-valuemax={props.max}
aria-valuemin={props.min}
aria-valuenow={current.value}
onBlur={onBlur}
onInput={onInput}
onFocus={onFocus}

View File

@ -206,7 +206,7 @@ exports[`should render demo and match snapshot 1`] = `
inputmode="decimal"
aria-valuemax="Infinity"
aria-valuemin="1"
aria-valuenow="1"
aria-valuenow="1.0"
>
<button type="button"
class="van-stepper__plus van-haptics-feedback"

View File

@ -68,6 +68,7 @@ export default defineComponent({
disabled,
})}
style={style}
tabindex={disabled ? undefined : 0}
aria-checked={checked}
onClick={onClick}
>

View File

@ -4,6 +4,7 @@ exports[`should render demo and match snapshot 1`] = `
<div>
<div role="switch"
class="van-switch van-switch--on"
tabindex="0"
aria-checked="true"
>
<div class="van-switch__node">
@ -22,6 +23,7 @@ exports[`should render demo and match snapshot 1`] = `
<div>
<div role="switch"
class="van-switch van-switch--on van-switch--loading"
tabindex="0"
aria-checked="true"
>
<div class="van-switch__node">
@ -46,6 +48,7 @@ exports[`should render demo and match snapshot 1`] = `
<div role="switch"
class="van-switch van-switch--on"
style="font-size: 24px;"
tabindex="0"
aria-checked="true"
>
<div class="van-switch__node">
@ -56,6 +59,7 @@ exports[`should render demo and match snapshot 1`] = `
<div role="switch"
class="van-switch van-switch--on"
style="background-color: rgb(238, 10, 36);"
tabindex="0"
aria-checked="true"
>
<div class="van-switch__node">
@ -65,6 +69,7 @@ exports[`should render demo and match snapshot 1`] = `
<div>
<div role="switch"
class="van-switch van-switch--on"
tabindex="0"
aria-checked="true"
>
<div class="van-switch__node">
@ -81,6 +86,7 @@ exports[`should render demo and match snapshot 1`] = `
<div role="switch"
class="van-switch van-switch--on"
style="font-size: 24px;"
tabindex="0"
aria-checked="true"
>
<div class="van-switch__node">