Commit b7071d2c37f6e6fd15e9e85fe6190d7895b31220
Committed by
GitHub
Merge pull request #3007 from Xotic750/switch_tabindex
Switch: Add keyboard control
Showing
1 changed file
with
6 additions
and
1 deletions
Show diff stats
src/components/switch/switch.vue
| 1 | <template> | 1 | <template> |
| 2 | - <span :class="wrapClasses" @click="toggle"> | 2 | + <span |
| 3 | + tabindex="0" | ||
| 4 | + :class="wrapClasses" | ||
| 5 | + @click="toggle" | ||
| 6 | + @keydown.space="toggle" | ||
| 7 | + > | ||
| 3 | <input type="hidden" :name="name" :value="currentValue"> | 8 | <input type="hidden" :name="name" :value="currentValue"> |
| 4 | <span :class="innerClasses"> | 9 | <span :class="innerClasses"> |
| 5 | <slot name="open" v-if="currentValue === trueValue"></slot> | 10 | <slot name="open" v-if="currentValue === trueValue"></slot> |