Skip to content

Commit 701e17b

Browse files
jonathanhefnerjavan
andcommitted
Fix submit button selector for type-less buttons
Follow-up to rails#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 <[email protected]>
1 parent 04f29cb commit 701e17b

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

activestorage/app/assets/javascripts/activestorage.esm.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

activestorage/app/assets/javascripts/activestorage.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

activestorage/app/javascript/activestorage/ujs.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ export function start() {
1515
}
1616

1717
function didClick(event) {
18-
const submitButton = event.target.closest(":is(button, input)[type='submit']")
19-
if (submitButton && submitButton.form) {
20-
submitButtonsByForm.set(submitButton.form, submitButton)
18+
const button = event.target.closest("button, input")
19+
if (button && button.type === "submit" && button.form) {
20+
submitButtonsByForm.set(button.form, button)
2121
}
2222
}
2323

0 commit comments

Comments
 (0)