File tree Expand file tree Collapse file tree 3 files changed +13
-3
lines changed Expand file tree Collapse file tree 3 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 11{
22  "name" : " @travelopia/web-components" 
3-   "version" : " 0.5.10 " 
3+   "version" : " 0.5.11 " 
44  "description" : " Accessible web components for the modern web" 
55  "files" : [
66    " dist" 
Original file line number Diff line number Diff line change @@ -86,6 +86,11 @@ export class TPFormFieldElement extends HTMLElement {
8686			return  true ; 
8787		} 
8888
89+ 		// Check if the field is not visible. 
90+ 		if  (  this . offsetWidth  <=  0  ||  this . offsetHeight  <=  0  )  { 
91+ 			return  true ; 
92+ 		} 
93+ 
8994		// Prepare error and valid status. 
9095		let  valid : boolean  =  true ; 
9196		let  error : string  =  '' ; 
@@ -137,14 +142,14 @@ export class TPFormFieldElement extends HTMLElement {
137142			this . appendChild (  errorElement  ) ; 
138143		} 
139144
140- 		this . dispatchEvent (  new  CustomEvent (  'validation-error' ,   {   bubbles :  true   }  )  ) ; 
145+ 		this . dispatchEvent (  new  CustomEvent (  'validation-error'  )  ) ; 
141146	} 
142147
143148	/** 
144149	 * Remove the error message. 
145150	 */ 
146151	removeErrorMessage ( ) : void { 
147152		this . querySelector (  'tp-form-error'  ) ?. remove ( ) ; 
148- 		this . dispatchEvent (  new  CustomEvent (  'validation-success' ,   {   bubbles :  true   }  )  ) ; 
153+ 		this . dispatchEvent (  new  CustomEvent (  'validation-success'  )  ) ; 
149154	} 
150155} 
Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ export class TPFormElement extends HTMLElement {
3737		const  formValid : boolean  =  this . validate ( ) ; 
3838		if  (  !  formValid  ||  'yes'  ===  this . getAttribute (  'prevent-submit'  )  )  { 
3939			e . preventDefault ( ) ; 
40+ 			e . stopImmediatePropagation ( ) ; 
4041		} 
4142
4243		const  submit : TPFormSubmitElement  |  null  =  this . querySelector (  'tp-form-submit'  ) ; 
@@ -47,6 +48,10 @@ export class TPFormElement extends HTMLElement {
4748				submit . removeAttribute (  'submitting'  ) ; 
4849			} 
4950		} 
51+ 
52+ 		if  (  formValid  )  { 
53+ 			this . dispatchEvent (  new  CustomEvent (  'submit-validation-success' ,  {  bubbles : true  }  )  ) ; 
54+ 		} 
5055	} 
5156
5257	/** 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments