1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Don't attach UJS form submission handlers to Turbo forms (#42476)

* Don't attach UJS form submission handlers to Turbo forms

Allows for easier migration of apps written for UJS, such that new work can be done with Turbo forms that are marked with data-turbo=true.

* Fix duplicate selectors

* Proper fix take 2
This commit is contained in:
David Heinemeier Hansson 2021-06-15 17:31:33 +02:00 committed by GitHub
parent 4e1fee11e5
commit 8de181dac6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -18,10 +18,10 @@
inputChangeSelector: 'select[data-remote], input[data-remote], textarea[data-remote]'
# Form elements bound by rails-ujs
formSubmitSelector: 'form'
formSubmitSelector: 'form:not([data-turbo=true])',
# Form input elements bound by rails-ujs
formInputClickSelector: 'form input[type=submit], form input[type=image], form button[type=submit], form button:not([type]), input[type=submit][form], input[type=image][form], button[type=submit][form], button[form]:not([type])'
formInputClickSelector: 'form:not([data-turbo=true]) input[type=submit], form:not([data-turbo=true]) input[type=image], form:not([data-turbo=true]) button[type=submit], form:not([data-turbo=true]) button:not([type]), input[type=submit][form], input[type=image][form], button[type=submit][form], button[form]:not([type])',
# Form input elements disabled during form submission
formDisableSelector: 'input[data-disable-with]:enabled, button[data-disable-with]:enabled, textarea[data-disable-with]:enabled, input[data-disable]:enabled, button[data-disable]:enabled, textarea[data-disable]:enabled'