mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Auto merge of #12365 - simartin:issue_12071, r=KiChjang
Issue #12071: Don't submit forms when typing Tab on an input. <!-- Please describe your changes on the following line: --> Fixes https://github.com/servo/servo/issues/12071 --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #12071 <!-- Either: --> - [X] There are tests for these changes <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12365) <!-- Reviewable:end -->
This commit is contained in:
commit
3c3c32f95e
3 changed files with 46 additions and 4 deletions
|
@ -6504,6 +6504,12 @@
|
|||
"url": "/_mozilla/mozilla/form_submit_about.html"
|
||||
}
|
||||
],
|
||||
"mozilla/form_tab_keyevent.html": [
|
||||
{
|
||||
"path": "mozilla/form_tab_keyevent.html",
|
||||
"url": "/_mozilla/mozilla/form_tab_keyevent.html"
|
||||
}
|
||||
],
|
||||
"mozilla/getBoundingClientRect.html": [
|
||||
{
|
||||
"path": "mozilla/getBoundingClientRect.html",
|
||||
|
|
27
tests/wpt/mozilla/tests/mozilla/form_tab_keyevent.html
Normal file
27
tests/wpt/mozilla/tests/mozilla/form_tab_keyevent.html
Normal file
|
@ -0,0 +1,27 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<html>
|
||||
<body>
|
||||
<title>Test for issue #12071</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<form name="f" id="f">
|
||||
<input type="text" name="input1" id="input1"/>
|
||||
<input type="submit" value="Submit"/>
|
||||
</form>
|
||||
<script>
|
||||
var test = async_test("TabShouldNotSubmit");
|
||||
var form = document.getElementById('f');
|
||||
var form_submitted = false;
|
||||
form.onsubmit = function(e) { form_submitted = true; return false; };
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
test.step(function() {
|
||||
var input = document.getElementById('input1');
|
||||
var evt = new KeyboardEvent("keydown", {key : "Tab"});
|
||||
input.dispatchEvent(evt);
|
||||
});
|
||||
});
|
||||
test.step_timeout(function() { assert_false(form_submitted, "Form should not be submitted"); test.done(); }, 500);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue