Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling form.reportValidity() bypasses Shoelace controls #772

Closed
claviska opened this issue Jun 1, 2022 · 4 comments
Closed

Calling form.reportValidity() bypasses Shoelace controls #772

claviska opened this issue Jun 1, 2022 · 4 comments
Assignees
Labels
bug Things that aren't working right in the library.

Comments

@claviska
Copy link
Member

claviska commented Jun 1, 2022

This is expected, but it's an edge case that's worth supporting. Unfortunately, I think this will only be possible by overloading the form's reportValidity() method.

Example: https://codepen.io/oliversalzburg/pen/vYdjxWq

@claviska claviska added the bug Things that aren't working right in the library. label Jun 1, 2022
@claviska claviska self-assigned this Jun 1, 2022
@claviska
Copy link
Member Author

claviska commented Jun 1, 2022

Thanks. This is the correct long term solution, but until Safari support lands, we have to use workarounds. There's a polyfill, but it has some limitations, one specifically for reportValidity().

@claviska
Copy link
Member Author

claviska commented Jun 1, 2022

Fixed in af1e440 by adding an overload to the FormSubmitController. Whenever a Shoelace form control is connected to the DOM, its containing form will have its reportValidity() method overloaded.

Again, this won't be necessary with ElementInternals, but for now this is the cleanest way I can think to solve it.

@oliversalzburg
Copy link
Contributor

Woah. That was lightning-fast! Thanks for the quick work 🌟

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Things that aren't working right in the library.
Projects
None yet
Development

No branches or pull requests

2 participants