Closed Bug 1535988 Opened 5 years ago Closed 5 years ago

Synthetic submit event should not trigger form submitting

Categories

(Core :: DOM: Core & HTML, defect, P2)

defect

Tracking

()

RESOLVED DUPLICATE of bug 1370630
mozilla68
Webcompat Priority ?
Tracking Status
firefox68 --- affected

People

(Reporter: xidorn, Assigned: smaug)

References

Details

Attachments

(2 files)

Attached file testcase

Steps to reproduce:

  1. open the attached testcase
  2. click the "submit" button

Expected result:
The button becomes disabled, and the page doesn't refresh.

Actual result:
The page refreshes.

Explanation:

When the button is clicked, it disables itself and dispatch a submit event to a <form>. This submit event makes the form submit while it shouldn't.

In the HTML spec, firing submit event is one step of form submit algorithm, and its return value is checked for whether the algorithm should continue. Given that, I don't think dispatching a synthetic submit event should trigger the form submitting again. (Unless I'm missing something?)

Chrome doesn't have this behavior, i.e. this synthetic submit event doesn't trigger form submitting.

This cause webcompat issue for login page of https://www.canva.com/ on Android (because it dispatches a submit event manually in some touch event handler, which doesn't affect desktop).

In addition to that, invoking preventDefault() in handler of submit doesn't stop the form submitting when it's triggered by a synthetic submit event.

This cause webcompat issue for login page of https://www.canva.com/ on Android (because it dispatches a submit event manually in some touch event handler, which doesn't affect desktop).

To make it clearer, Firefox users on Android cannot login to Canva because of this issue.

Flags: webcompat?
Component: DOM: Events → DOM: Core & HTML
Assignee: nobody → bugs
Priority: -- → P2

remote: Follow the progress of your build on Treeherder:
remote: https://treeherder.mozilla.org/#/jobs?repo=try&revision=7d168fa74e5663d7ddcb99128ebc26247b66ab1d
remote: recorded changegroup in replication log in 0.047s

Pushed by opettay@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c8c4ac7eacee
Synthetic submit event should not trigger form submitting, r=baku
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla68
Depends on: 1537555
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/16001 for changes under testing/web-platform/tests
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Status: REOPENED → RESOLVED
Closed: 5 years ago5 years ago
Resolution: --- → FIXED
Status: RESOLVED → REOPENED
Keywords: leave-open
Resolution: FIXED → ---

See bug 1547409. Moving webcompat whiteboard tags to project flags.

Webcompat Priority: --- → ?

Should this be closed as a dupe of Bug 1370630?

Flags: needinfo?(xidorn+moz)

Probably. The description of bug is quite different bug as far as the patch is effectively the same, I guess we can mark them duplicate.

If that bug ends up doing something different, then maybe we should reopen this one.

Flags: needinfo?(xidorn+moz)
Status: REOPENED → RESOLVED
Closed: 5 years ago5 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: