-
Notifications
You must be signed in to change notification settings - Fork 432
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
requestSubmit on safari incorrectly sets the submitter property on the SubmitEvent #1071
Comments
I see you've opened https://bugs.webkit.org/show_bug.cgi?id=265077, that's great! |
Unfortunately I think I jumped the gun on that one, since it seems removing Turbo from being loaded makes Safari work correctly. I've resolved that issue for now, but would be willing to open another one if needed. I had simply removed using turbo features explicitly, but was obviously still using it since it was being loaded. |
I think this is a dupe of #933. It just has not made it in a release yet. |
Excellent! I can't believe I missed the PR, I searched for existing issues. I'll give the master branch a try.. |
You've got https://github.com/hotwired/dev-builds/tags as well. |
I also had opened this about a month ago but got no attention haha #1050 |
I think it will be fixed in the next version of turbo, for now you can grab their polyfill for requestSubmit and use that. |
I've been using Turbo Streams with a custom idiomorph action (though this bug occurs without idiomorph, see the sandbox below for a minimal example) and came across a bug with Turbo & Safari (tested on version 17) that might affect the upcoming refresh feature.
I have a form with multiple submit buttons that have different names, and some stimulus actions that submit the form via
requestSubmit()
. Clicking a button submits the form to the server and re-renders it with idiomorph., On Safari the requestSubmit form submissions will include the name/value of the previously used submit button.So, if I submit the form with a submit button that is
effect=add_distribution
, then net time I submit the form withrequestSubmit
(regardless of whether I pass a submitter in or not, I tried adding a hidden submit button and specifying that), the previouseffect=add_distribution
parameter is sent to the server.Firefox/Chrome work correctly and respect the submitter specified (or not) to
requestSubmit
Anyway, for now I'm using the polyfill from Turbo regardless of whether the browser supports requestSubmit natively or not and that fixes the problem.
Just thought I'd bring it to your attention since people will be enjoying less javascript in Turbo 8 with idiomorph and refresh.
Here's a code sandbox showing the issue. If you comment out Turbo, the console shows the correct submitter, but with Turbo enabled, it uses the previous submitter.
The text was updated successfully, but these errors were encountered: