Fixed #2329 - DataTable SelectAll checkbox stay focused after deselecting

pull/2873/head
mertsincan 2022-08-22 16:23:32 +01:00
parent 4e22038457
commit e08347fbfc
1 changed files with 5 additions and 8 deletions

View File

@ -1,9 +1,7 @@
<template> <template>
<div :class="['p-checkbox p-component', {'p-checkbox-focused': focused}]" @click="onClick"> <div :class="['p-checkbox p-component', {'p-checkbox-focused': focused, 'p-disabled': $attrs.disabled}]" @click="onClick" @keydown.space.prevent="onClick">
<div class="p-hidden-accessible"> <div ref="box" :class="['p-checkbox-box p-component', {'p-highlight': checked, 'p-disabled': $attrs.disabled, 'p-focus': focused}]"
<input ref="input" type="checkbox" :checked="checked" @focus="onFocus($event)" @blur="onBlur($event)" :disabled="disabled"> role="checkbox" :aria-checked="checked" :tabindex="$attrs.disabled ? null : '0'" @focus="onFocus($event)" @blur="onBlur($event)">
</div>
<div ref="box" :class="['p-checkbox-box p-component', {'p-highlight': checked, 'p-disabled': $attrs.disabled, 'p-focus': focused}]" role="checkbox" :aria-checked="checked">
<span :class="['p-checkbox-icon', {'pi pi-check': checked}]"></span> <span :class="['p-checkbox-icon', {'pi pi-check': checked}]"></span>
</div> </div>
</div> </div>
@ -13,7 +11,6 @@
export default { export default {
inheritAttrs: false, inheritAttrs: false,
props: { props: {
disabled: null,
checked: null checked: null
}, },
data() { data() {
@ -23,7 +20,7 @@ export default {
}, },
methods: { methods: {
onClick(event) { onClick(event) {
if (!this.disabled) { if (!this.$attrs.disabled) {
this.focused = true; this.focused = true;
this.$emit('change', { this.$emit('change', {
originalEvent: event, originalEvent: event,