Skip to content

Commit

Permalink
fix(Switch): [Switch] add keydown support and improth the accessibili…
Browse files Browse the repository at this point in the history
…ty (#1428)
  • Loading branch information
AcWrong02 authored Feb 28, 2024
1 parent 990c9fb commit e32c022
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/theme/src/switch/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,14 @@
position: relative;
cursor: pointer;
outline: none;
transition: all 0.2s ease-in-out;
transition:
border 0.2s ease-in-out,
background-color 0.2s ease-in-out;

&:focus-visible {
outline: 2px solid var(--ti-switch-on-bg-color);
outline-offset: 1px;
}

& &-inner {
color: var(--ti-switch-text-color);
Expand Down
1 change: 1 addition & 0 deletions packages/vue/src/switch/src/pc.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
:tabindex="tabindex"
@click="toggle"
@keydown.space="toggle"
@keydown.enter="toggle"
>
<span :class="state.innerClasses">
<div v-if="!mini && state.showText">
Expand Down

0 comments on commit e32c022

Please sign in to comment.