From 8214bf8d0211f2352886d10ec2c74dc71a848119 Mon Sep 17 00:00:00 2001 From: neverland Date: Wed, 17 Nov 2021 16:57:47 +0800 Subject: [PATCH] feat(Popover): add tabindex and aria-disabled for a11y (#9889) --- packages/vant/src/popover/Popover.tsx | 2 ++ .../vant/src/popover/test/__snapshots__/index.spec.tsx.snap | 2 ++ packages/vant/src/rate/Rate.tsx | 2 +- packages/vant/src/slider/Slider.tsx | 4 ++-- packages/vant/src/stepper/Stepper.tsx | 6 +++--- .../vant/src/stepper/test/__snapshots__/demo.spec.ts.snap | 2 +- 6 files changed, 11 insertions(+), 7 deletions(-) diff --git a/packages/vant/src/popover/Popover.tsx b/packages/vant/src/popover/Popover.tsx index 194ba5d03..5116e8a9c 100644 --- a/packages/vant/src/popover/Popover.tsx +++ b/packages/vant/src/popover/Popover.tsx @@ -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 && ( diff --git a/packages/vant/src/popover/test/__snapshots__/index.spec.tsx.snap b/packages/vant/src/popover/test/__snapshots__/index.spec.tsx.snap index 09edde75a..cbb839bc2 100644 --- a/packages/vant/src/popover/test/__snapshots__/index.spec.tsx.snap +++ b/packages/vant/src/popover/test/__snapshots__/index.spec.tsx.snap @@ -3,6 +3,7 @@ exports[`should allow to custom the className of action 1`] = `