Skip to content

Commit

Permalink
add condition check for clearing indeterminate
Browse files Browse the repository at this point in the history
  • Loading branch information
jamigibbs committed Dec 6, 2024
1 parent 218ce4e commit 667d9d2
Showing 1 changed file with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,25 +163,21 @@ export class VaCheckbox {
* Primarily for a11y; input.indeterminate must be set with JavaScript,
* there is no HTML attribute for this.
*/
private updateIndeterminateInput() {
private handleIndeterminateInput() {
const input = this.el.shadowRoot.querySelector('input');
if (!this.checked) {
if (this.indeterminate && !this.checked) {
input.indeterminate = true;
} else {
input.indeterminate = false;
}
}

componentDidUpdate() {
if (this.indeterminate) {
this.updateIndeterminateInput();
}
this.handleIndeterminateInput();
}

componentDidLoad() {
if (this.indeterminate) {
this.updateIndeterminateInput();
}
this.handleIndeterminateInput();
}

connectedCallback() {
Expand Down

0 comments on commit 667d9d2

Please sign in to comment.