File tree 1 file changed +11
-8
lines changed 1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -99,9 +99,18 @@ function setLoadingState(event: Event) {
99
99
const input = event . currentTarget
100
100
if ( ! ( input instanceof HTMLInputElement ) ) return
101
101
102
+ let message = 'Verifying…'
103
+ const setValidity = text => ( message = text )
104
+ input . dispatchEvent (
105
+ new CustomEvent ( 'auto-check-loading' , {
106
+ bubbles : true ,
107
+ detail : { setValidity}
108
+ } )
109
+ )
110
+
102
111
const autoCheckElement = input . closest ( 'auto-check' )
103
112
if ( autoCheckElement instanceof AutoCheckElement && autoCheckElement . required ) {
104
- input . setCustomValidity ( 'Verifying…' )
113
+ input . setCustomValidity ( message )
105
114
}
106
115
}
107
116
@@ -152,12 +161,10 @@ async function check(autoCheckElement: AutoCheckElement) {
152
161
if ( id && id === state . previousValue ) return
153
162
state . previousValue = id
154
163
155
- let message = 'Verifying…'
156
- const setValidity = text => ( message = text )
157
164
input . dispatchEvent (
158
165
new CustomEvent ( 'auto-check-send' , {
159
166
bubbles : true ,
160
- detail : { body, setValidity }
167
+ detail : { body}
161
168
} )
162
169
)
163
170
@@ -169,10 +176,6 @@ async function check(autoCheckElement: AutoCheckElement) {
169
176
return
170
177
}
171
178
172
- if ( autoCheckElement . required ) {
173
- input . setCustomValidity ( message )
174
- }
175
-
176
179
if ( state . controller ) {
177
180
state . controller . abort ( )
178
181
} else {
You can’t perform that action at this time.
0 commit comments