From 8e46414bd52cafdb765c68b89caaf4ace133b636 Mon Sep 17 00:00:00 2001 From: Maria Hutt Date: Mon, 3 Nov 2025 08:57:39 -0800 Subject: [PATCH] refactor(checkbox): cleanup --- core/src/components/checkbox/checkbox.tsx | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/core/src/components/checkbox/checkbox.tsx b/core/src/components/checkbox/checkbox.tsx index 67927944b5..2059f1e747 100644 --- a/core/src/components/checkbox/checkbox.tsx +++ b/core/src/components/checkbox/checkbox.tsx @@ -1,5 +1,5 @@ import type { ComponentInterface, EventEmitter } from '@stencil/core'; -import { Component, Element, Event, Host, Method, Prop, State, h, forceUpdate, Build } from '@stencil/core'; +import { Component, Element, Event, Host, Method, Prop, State, h, Build } from '@stencil/core'; import { checkInvalidState } from '@utils/forms'; import type { Attributes } from '@utils/helpers'; import { inheritAriaAttributes, renderHiddenInput } from '@utils/helpers'; @@ -186,7 +186,7 @@ export class Checkbox implements ComponentInterface { } // Always set initial state - this.isInvalid = this.checkInvalidState(); + this.isInvalid = checkInvalidState(el); } componentWillLoad() { @@ -235,13 +235,6 @@ export class Checkbox implements ComponentInterface { }; private onBlur = () => { - const newIsInvalid = this.checkInvalidState(); - if (this.isInvalid !== newIsInvalid) { - this.isInvalid = newIsInvalid; - // Force a re-render to update aria-describedby immediately. - forceUpdate(this); - } - this.ionBlur.emit(); }; @@ -312,16 +305,6 @@ export class Checkbox implements ComponentInterface { ); } - /** - * Checks if the input is in an invalid state based on Ionic validation classes - */ - private checkInvalidState(): boolean { - const hasIonTouched = this.el.classList.contains('ion-touched'); - const hasIonInvalid = this.el.classList.contains('ion-invalid'); - - return hasIonTouched && hasIonInvalid; - } - render() { const { color,