Commit ea49834da932bc0606147dd2653faa07de6eb277
1 parent
98252a9e
Focus on <label> when <input> gets the focus
Showing
1 changed file
with
8 additions
and
5 deletions
Show diff stats
src/components/checkbox/checkbox.vue
| ... | ... | @@ -8,22 +8,26 @@ |
| 8 | 8 | <input |
| 9 | 9 | v-if="group" |
| 10 | 10 | type="checkbox" |
| 11 | - tabindex="-1" | |
| 11 | + tabindex="-1" | |
| 12 | 12 | :class="inputClasses" |
| 13 | 13 | :disabled="disabled" |
| 14 | 14 | :value="label" |
| 15 | 15 | v-model="model" |
| 16 | 16 | :name="name" |
| 17 | - @change="change"> | |
| 17 | + @change="change" | |
| 18 | + @focus="$el.focus()" | |
| 19 | + > | |
| 18 | 20 | <input |
| 19 | 21 | v-if="!group" |
| 20 | 22 | type="checkbox" |
| 21 | - tabindex="-1" | |
| 23 | + tabindex="-1" | |
| 22 | 24 | :class="inputClasses" |
| 23 | 25 | :disabled="disabled" |
| 24 | 26 | :checked="currentValue" |
| 25 | 27 | :name="name" |
| 26 | - @change="change"> | |
| 28 | + @change="change" | |
| 29 | + @focus="$el.focus()" | |
| 30 | + > | |
| 27 | 31 | </span> |
| 28 | 32 | <slot><span v-if="showSlot">{{ label }}</span></slot> |
| 29 | 33 | </label> |
| ... | ... | @@ -120,7 +124,6 @@ |
| 120 | 124 | }, |
| 121 | 125 | methods: { |
| 122 | 126 | change (event) { |
| 123 | - console.log(event); | |
| 124 | 127 | if (this.disabled) { |
| 125 | 128 | return false; |
| 126 | 129 | } | ... | ... |