Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Depends on #1217
Follow-up to #386
While Turbo's support for disabling a Form Submissions
<input type="submit">
or<button>
element is rooted in Rails UJS, itdegrades (and has always degraded) the accessibility of those
experiences.
To learn more about the risks involved, read the Don't Disable
Submits section of Adrian Roselli's Don't Disable Form Controls
along with the additional resources mentioned therein.
The risk of degrading accessibility is especially true for Morph-enabled
Form Submissions. If a form submission will trigger a morphing Page
Refresh with the submitter focused, it's likely that the focus is
intended to remain on the submitter.
With the current
[disabled]
behavior, that is not possible without abespoke event handler like:
This commit introduces a
Turbo.config.forms.submitter
object with twopre-defined keys:
"disabled"
(the default until we can deprecate it),and
"aria-disabled"
.When applications specify either
Turbo.config.forms.submitter = "disabled"
orTurbo.config.forms.submitter = "aria-disabled"
, theywill be able to leverage those pre-packed hooks. Otherwise, they can
provide their own object with
beforeSubmit(submitter)
andafterSubmit(submitter)
functions.