-
Notifications
You must be signed in to change notification settings - Fork 31
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
Invalid elements allow trigger inline submit
handlers and preact submit handlers
#40
Comments
This is partially resolved in @enjoythelive1, would you have any idea how to access that callback function (or know anyone who might)? I'm guessing it's in Preact's internals and we might be out of luck there. |
I think it has to do with how the vdom renders the components. The listeners to the form are attached before the polyfill can attach them, because the custom elements are instantiated after the form was instantiated with its own properties. I think we need to catch the event before the target phase of it ('using capture'). Maybe a listener with I would implement it my self, but I do't know my way around your test suite. |
Yeah, that's exactly it. It looks like I'll have to patch |
This issue is still a thing. Run this example (before fix) in Safari or overwrite the function function isElementInternalsSupported() { return false; } This example shows that the submit event handlers added to the form programmatically can submit data even if the form is invalid. To prevent this, we should listen to the submit events on the submit button and prevent default handling. This example (with fix) does precisely this. PR is coming. |
Listen for submit events on the closest submit button and if the form is invalid prevent the default handling.
Should be fixed in |
The issue is that these listeners are registered before the polyfill has time to register its own listener to stop the propagation of the submit event.
Here I include 3 reproductions:
The text was updated successfully, but these errors were encountered: