Skip to content

Commit

Permalink
Fix submit button selector for type-less buttons
Browse files Browse the repository at this point in the history
Follow-up to #48290.

The `:is(button, input)[type='submit']` selector does not match `button`
elements that omit the `type` attribute in favor relying on its default
value (which is `"submit"`).

Co-authored-by: Javan Makhmali <javan@javan.us>
  • Loading branch information
jonathanhefner and javan committed Nov 24, 2023
1 parent 04f29cb commit 701e17b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions activestorage/app/assets/javascripts/activestorage.esm.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions activestorage/app/assets/javascripts/activestorage.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions activestorage/app/javascript/activestorage/ujs.js
Expand Up @@ -15,9 +15,9 @@ export function start() {
}

function didClick(event) {
const submitButton = event.target.closest(":is(button, input)[type='submit']")
if (submitButton && submitButton.form) {
submitButtonsByForm.set(submitButton.form, submitButton)
const button = event.target.closest("button, input")
if (button && button.type === "submit" && button.form) {
submitButtonsByForm.set(button.form, button)
}
}

Expand Down

0 comments on commit 701e17b

Please sign in to comment.