Fixed #406 - Refactor selectbutton focus visuals
parent
fc51327148
commit
4a2493d30c
|
@ -27,11 +27,6 @@ export default {
|
||||||
dataKey: null,
|
dataKey: null,
|
||||||
ariaLabelledBy: null
|
ariaLabelledBy: null
|
||||||
},
|
},
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
focusedIndex: null
|
|
||||||
};
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
getOptionLabel(option) {
|
getOptionLabel(option) {
|
||||||
return this.optionLabel ? ObjectUtils.resolveFieldData(option, this.optionLabel) : option;
|
return this.optionLabel ? ObjectUtils.resolveFieldData(option, this.optionLabel) : option;
|
||||||
|
@ -87,18 +82,15 @@ export default {
|
||||||
return selected;
|
return selected;
|
||||||
},
|
},
|
||||||
onFocus(event, index) {
|
onFocus(event, index) {
|
||||||
this.focusedIndex = index;
|
|
||||||
this.$emit('focus', event);
|
this.$emit('focus', event);
|
||||||
},
|
},
|
||||||
onBlur(event) {
|
onBlur(event) {
|
||||||
this.focusedIndex = null
|
|
||||||
this.$emit('blur', event);
|
this.$emit('blur', event);
|
||||||
},
|
},
|
||||||
getButtonClass(option, i) {
|
getButtonClass(option, i) {
|
||||||
return ['p-button p-component', {
|
return ['p-button p-component', {
|
||||||
'p-highlight': this.isSelected(option),
|
'p-highlight': this.isSelected(option),
|
||||||
'p-disabled': this.isOptionDisabled(option),
|
'p-disabled': this.isOptionDisabled(option)
|
||||||
'p-focus': (i === this.focusedIndex)
|
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue