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,22 +8,26 @@ | ||
8 | <input | 8 | <input |
9 | v-if="group" | 9 | v-if="group" |
10 | type="checkbox" | 10 | type="checkbox" |
11 | - tabindex="-1" | 11 | + tabindex="-1" |
12 | :class="inputClasses" | 12 | :class="inputClasses" |
13 | :disabled="disabled" | 13 | :disabled="disabled" |
14 | :value="label" | 14 | :value="label" |
15 | v-model="model" | 15 | v-model="model" |
16 | :name="name" | 16 | :name="name" |
17 | - @change="change"> | 17 | + @change="change" |
18 | + @focus="$el.focus()" | ||
19 | + > | ||
18 | <input | 20 | <input |
19 | v-if="!group" | 21 | v-if="!group" |
20 | type="checkbox" | 22 | type="checkbox" |
21 | - tabindex="-1" | 23 | + tabindex="-1" |
22 | :class="inputClasses" | 24 | :class="inputClasses" |
23 | :disabled="disabled" | 25 | :disabled="disabled" |
24 | :checked="currentValue" | 26 | :checked="currentValue" |
25 | :name="name" | 27 | :name="name" |
26 | - @change="change"> | 28 | + @change="change" |
29 | + @focus="$el.focus()" | ||
30 | + > | ||
27 | </span> | 31 | </span> |
28 | <slot><span v-if="showSlot">{{ label }}</span></slot> | 32 | <slot><span v-if="showSlot">{{ label }}</span></slot> |
29 | </label> | 33 | </label> |
@@ -120,7 +124,6 @@ | @@ -120,7 +124,6 @@ | ||
120 | }, | 124 | }, |
121 | methods: { | 125 | methods: { |
122 | change (event) { | 126 | change (event) { |
123 | - console.log(event); | ||
124 | if (this.disabled) { | 127 | if (this.disabled) { |
125 | return false; | 128 | return false; |
126 | } | 129 | } |