Skip to content

Commit b6cd951

Browse files
VictorCazanaveeuvl
authored andcommitted
Improve accessibility (#85)
* Use opacity to hide input * Fix color property validator * Delete ariaChecked computed property
1 parent 7550a4b commit b6cd951

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/Button.vue

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<template>
2-
<label role="checkbox"
3-
:class="className"
4-
:aria-checked="ariaChecked">
2+
<label :class="className">
53
<input type="checkbox"
64
class="v-switch-input"
75
:name="name"
@@ -70,7 +68,7 @@ export default {
7068
type: [String, Object],
7169
validator (value) {
7270
return typeof value === 'object'
73-
? (value.checked || value.unchecked)
71+
? (value.checked || value.unchecked || value.disabled)
7472
: typeof value === 'string'
7573
}
7674
},
@@ -111,10 +109,6 @@ export default {
111109
return ['vue-js-switch', { toggled, disabled }]
112110
},
113111
114-
ariaChecked () {
115-
return this.toggled.toString()
116-
},
117-
118112
coreStyle () {
119113
return {
120114
width: px(this.width),
@@ -265,7 +259,10 @@ $margin: 3px;
265259
cursor: pointer;
266260
267261
.v-switch-input {
268-
display: none;
262+
opacity: 0;
263+
position: absolute;
264+
width: 1px;
265+
height: 1px;
269266
}
270267
271268
.v-switch-label {

0 commit comments

Comments
 (0)