@@ -15,7 +15,7 @@ import {
1515 writeTask ,
1616} from '@stencil/core' ;
1717import type { NotchController } from '@utils/forms' ;
18- import { createNotchController } from '@utils/forms' ;
18+ import { createNotchController , checkInvalidState } from '@utils/forms' ;
1919import type { Attributes } from '@utils/helpers' ;
2020import { inheritAriaAttributes , debounceEvent , inheritAttributes , componentOnReady } from '@utils/helpers' ;
2121import { createSlotMutationController } from '@utils/slot-mutation-controller' ;
@@ -335,16 +335,6 @@ export class Textarea implements ComponentInterface {
335335 }
336336 }
337337
338- /**
339- * Checks if the textarea is in an invalid state based on Ionic validation classes
340- */
341- private checkValidationState ( ) : boolean {
342- const hasIonTouched = this . el . classList . contains ( 'ion-touched' ) ;
343- const hasIonInvalid = this . el . classList . contains ( 'ion-invalid' ) ;
344-
345- return hasIonTouched && hasIonInvalid ;
346- }
347-
348338 connectedCallback ( ) {
349339 const { el } = this ;
350340 this . slotMutationController = createSlotMutationController ( el , [ 'label' , 'start' , 'end' ] , ( ) => forceUpdate ( this ) ) ;
@@ -357,7 +347,7 @@ export class Textarea implements ComponentInterface {
357347 // Watch for class changes to update validation state
358348 if ( Build . isBrowser && typeof MutationObserver !== 'undefined' ) {
359349 this . validationObserver = new MutationObserver ( ( ) => {
360- const newIsInvalid = this . checkValidationState ( ) ;
350+ const newIsInvalid = checkInvalidState ( this . el ) ;
361351 if ( this . isInvalid !== newIsInvalid ) {
362352 this . isInvalid = newIsInvalid ;
363353 // Force a re-render to update aria-describedby immediately
@@ -372,7 +362,7 @@ export class Textarea implements ComponentInterface {
372362 }
373363
374364 // Always set initial state
375- this . isInvalid = this . checkValidationState ( ) ;
365+ this . isInvalid = checkInvalidState ( this . el ) ;
376366
377367 this . debounceChanged ( ) ;
378368 if ( Build . isBrowser ) {
0 commit comments