Form controls: why type="module"
required for validation and preventDefault
#782
-
Hi, take the codepen example from https://shoelace.style/getting-started/form-controls?id=required-fields and remove My question is: why? 😄 Thanks for helpful answers. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Scripts with Lines 49 to 50 in 01eb84e Unfortunately, that means it's possible to attach listeners that execute before the controller's listeners. It's something we need to workaround until we can use You might recall in previous versions there was an I hope that helps! |
Beta Was this translation helpful? Give feedback.
Scripts with
type="module"
are deferred, whereas scripts without it are executed synchronously. UntilElementInternals
lands, Shoelace needs to use a reactive controller to handle form submissions.shoelace/src/internal/form.ts
Lines 49 to 50 in 01eb84e
Unfortunately, that means it's possible to attach listeners that execute before the controller's listeners. It's something we need to workaround until we can use
ElementInternals
to make Shoelace form controls first-class citizens.You might recall in previous versions there was an
<sl-form>
eleme…