Skip to content

Commit f6b682e

Browse files
Merge pull request #8141 from geiregjo/feature/fix-checkbox-indeterminate
Indicate indeterminate state with prop iso aria-checked attr
2 parents d7ced77 + 08ec9da commit f6b682e

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

packages/primevue/src/checkbox/Checkbox.vue

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<template>
22
<div :class="cx('root')" v-bind="getPTOptions('root')" :data-p-checked="checked" :data-p-indeterminate="d_indeterminate || undefined" :data-p-disabled="disabled" :data-p="dataP">
33
<input
4+
ref="input"
45
:id="inputId"
56
type="checkbox"
67
:class="[cx('input'), inputClass]"
@@ -15,7 +16,6 @@
1516
:aria-labelledby="ariaLabelledby"
1617
:aria-label="ariaLabel"
1718
:aria-invalid="invalid || undefined"
18-
:aria-checked="d_indeterminate ? 'mixed' : undefined"
1919
@focus="onFocus"
2020
@blur="onBlur"
2121
@change="onChange"
@@ -55,7 +55,15 @@ export default {
5555
watch: {
5656
indeterminate(newValue) {
5757
this.d_indeterminate = newValue;
58-
}
58+
59+
this.updateIndeterminate();
60+
},
61+
},
62+
mounted() {
63+
this.updateIndeterminate();
64+
},
65+
updated() {
66+
this.updateIndeterminate();
5967
},
6068
methods: {
6169
getPTOptions(key) {
@@ -96,6 +104,11 @@ export default {
96104
onBlur(event) {
97105
this.$emit('blur', event);
98106
this.formField.onBlur?.(event);
107+
},
108+
updateIndeterminate() {
109+
if (this.$refs.input) {
110+
this.$refs.input.indeterminate = this.d_indeterminate;
111+
}
99112
}
100113
},
101114
computed: {

0 commit comments

Comments
 (0)