|
1 | 1 | import type { ComponentInterface, EventEmitter } from '@stencil/core'; |
2 | | -import { Component, Element, Event, Host, Method, Prop, State, h, forceUpdate, Build } from '@stencil/core'; |
| 2 | +import { Component, Element, Event, Host, Method, Prop, State, h, Build } from '@stencil/core'; |
3 | 3 | import { checkInvalidState } from '@utils/forms'; |
4 | 4 | import type { Attributes } from '@utils/helpers'; |
5 | 5 | import { inheritAriaAttributes, renderHiddenInput } from '@utils/helpers'; |
@@ -186,7 +186,7 @@ export class Checkbox implements ComponentInterface { |
186 | 186 | } |
187 | 187 |
|
188 | 188 | // Always set initial state |
189 | | - this.isInvalid = this.checkInvalidState(); |
| 189 | + this.isInvalid = checkInvalidState(el); |
190 | 190 | } |
191 | 191 |
|
192 | 192 | componentWillLoad() { |
@@ -235,13 +235,6 @@ export class Checkbox implements ComponentInterface { |
235 | 235 | }; |
236 | 236 |
|
237 | 237 | private onBlur = () => { |
238 | | - const newIsInvalid = this.checkInvalidState(); |
239 | | - if (this.isInvalid !== newIsInvalid) { |
240 | | - this.isInvalid = newIsInvalid; |
241 | | - // Force a re-render to update aria-describedby immediately. |
242 | | - forceUpdate(this); |
243 | | - } |
244 | | - |
245 | 238 | this.ionBlur.emit(); |
246 | 239 | }; |
247 | 240 |
|
@@ -312,16 +305,6 @@ export class Checkbox implements ComponentInterface { |
312 | 305 | ); |
313 | 306 | } |
314 | 307 |
|
315 | | - /** |
316 | | - * Checks if the input is in an invalid state based on Ionic validation classes |
317 | | - */ |
318 | | - private checkInvalidState(): boolean { |
319 | | - const hasIonTouched = this.el.classList.contains('ion-touched'); |
320 | | - const hasIonInvalid = this.el.classList.contains('ion-invalid'); |
321 | | - |
322 | | - return hasIonTouched && hasIonInvalid; |
323 | | - } |
324 | | - |
325 | 308 | render() { |
326 | 309 | const { |
327 | 310 | color, |
|
0 commit comments