fix(Switch): [Switch] add keydown support and improth the accessibility (#1428)

This commit is contained in:
AcWrong02 2024-02-28 18:06:13 +08:00 committed by GitHub
parent 990c9fb816
commit e32c0227cd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 1 deletions

View File

@ -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);

View File

@ -16,6 +16,7 @@
:tabindex="tabindex"
@click="toggle"
@keydown.space="toggle"
@keydown.enter="toggle"
>
<span :class="state.innerClasses">
<div v-if="!mini && state.showText">