Skip to content

Commit a8f720b

Browse files
committed
clear customValidity with empty string
1 parent 82df3a8 commit a8f720b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

packages/uui-base/lib/mixins/FormControlMixin.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,12 @@ export const FormControlMixin = <T extends Constructor<LitElement>>(
216216
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLObjectElement/setCustomValidity|HTMLObjectElement:setCustomValidity}
217217
*/
218218
protected setCustomValidity(message: string) {
219+
if (message === '') {
220+
this._internals.setValidity({});
221+
this.dispatchEvent(new UUIFormControlEvent(UUIFormControlEvent.VALID));
222+
return;
223+
}
224+
219225
this._internals.setValidity(
220226
{ customError: true },
221227
message,

0 commit comments

Comments
 (0)