forked from SerenityOS/serenity
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LibWeb: Prevent checkboxes from firing change events when losing focus
This is because toggling the checkbox is committing the value. (cherry picked from commit 3856dd946b94b61be2ddac80c8cf60278fcc56ab; amended to add two spaces to expected output due to serenity not yet having LadybirdBrowser/ladybird#1603, and to add a trailing newline to the test input file)
- Loading branch information
Showing
3 changed files
with
18 additions
and
0 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
Tests/LibWeb/Text/expected/checkbox-focus-lost-no-change-event.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
16 changes: 16 additions & 0 deletions
16
Tests/LibWeb/Text/input/checkbox-focus-lost-no-change-event.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!DOCTYPE html> | ||
<input type="checkbox" id="checkbox"> | ||
<script src="include.js"></script> | ||
<script> | ||
checkbox.addEventListener("change", () => { | ||
println("Change event was fired when it shouldn't have been."); | ||
}); | ||
asyncTest(async done => { | ||
checkbox.focus(); | ||
await new Promise(resolve => setTimeout(resolve, 0)); | ||
checkbox.blur(); | ||
await new Promise(resolve => setTimeout(resolve, 0)); | ||
|
||
done(); | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters