diff --git a/src/lib/MultiSelect.svelte b/src/lib/MultiSelect.svelte index 6de2ece..640a16c 100644 --- a/src/lib/MultiSelect.svelte +++ b/src/lib/MultiSelect.svelte @@ -459,6 +459,10 @@ // create Highlight object from ranges and add to registry CSS.highlights.set(`sms-search-matches`, new Highlight(...ranges.flat())) } + + // reset form validation when required prop changes + // https://github.com/janosh/svelte-multiselect/issues/285 + $: required, form_input?.setCustomValidity(``) = Number(required) ? JSON.stringify(selected) : null} tabindex="-1" aria-hidden="true"