Skip to content

Commit

Permalink
fix radio/checkbox aria attrs bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
Justineo committed Mar 5, 2018
1 parent c66ce3e commit a13fb81
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
7 changes: 5 additions & 2 deletions packages/veui/src/components/Checkbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
<label :class="{
'veui-checkbox': true,
'veui-disabled': realReadonly || realDisabled
}" :ui="ui">
}"
:ui="ui">
<input ref="box" type="checkbox" v-bind="attrs" @change="handleChange">
<span class="veui-checkbox-box">
<icon v-if="isChecked || localIndeterminate" :name="icons[localIndeterminate ? 'indeterminate' : 'checked']"></icon>
Expand All @@ -19,6 +20,7 @@ import { patchIndeterminate } from '../utils/dom'
export default {
name: 'veui-checkbox',
inheritAttrs: false,
components: {
Icon
},
Expand Down Expand Up @@ -54,7 +56,8 @@ export default {
return {
name: this.realName,
disabled: this.realDisabled || this.realReadonly,
checked: this.isChecked
checked: this.isChecked,
...this.$attrs
}
},
isChecked () {
Expand Down
7 changes: 5 additions & 2 deletions packages/veui/src/components/Radio.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
<label :class="{
'veui-radio': true,
'veui-disabled': realReadonly || realDisabled
}" :ui="ui">
}"
:ui="ui">
<input type="radio" v-bind="attrs" @change="localChecked = $event.target.checked">
<span class="veui-radio-box"></span>
<span class="veui-radio-label"><slot></slot></span>
Expand All @@ -14,6 +15,7 @@ import input from '../mixins/input'
export default {
name: 'veui-radio',
inheritAttrs: false,
mixins: [input],
model: {
prop: 'checked',
Expand All @@ -37,7 +39,8 @@ export default {
return {
checked: this.localChecked,
name: this.realName,
disabled: this.realDisabled || this.realReadonly
disabled: this.realDisabled || this.realReadonly,
...this.$attrs
}
}
},
Expand Down
3 changes: 2 additions & 1 deletion packages/veui/src/components/RadioButtonGroup.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<template>
<div class="veui-radio-button-group veui-button-group"
<div
class="veui-radio-button-group veui-button-group"
:ui="ui"
role="radiogroup"
:aria-readonly="String(realReadonly)"
Expand Down

0 comments on commit a13fb81

Please sign in to comment.