mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 09:45:06 +02:00
LibWeb: Support committing changes to <input> elements
We currently fire the change event on <input> elements when they lose focus. The spec allows for us to also fire the event when changes are "committed", so long as such an action makes sense for the input type. This patch detects when the return key is entered in an <input> element and uses that as the commit action for text-related types. If no change has occurred since the last commit, no change event is fired.
This commit is contained in:
committed by
Andreas Kling
parent
97665fa92f
commit
7edfeb7056
Notes:
sideshowbarker
2024-07-17 09:41:18 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/7edfeb7056 Pull-request: https://github.com/SerenityOS/serenity/pull/22111
15
Tests/LibWeb/Text/input/input-commit.html
Normal file
15
Tests/LibWeb/Text/input/input-commit.html
Normal file
@@ -0,0 +1,15 @@
|
||||
<input id=input type=text>
|
||||
<script src="include.js"></script>
|
||||
<script>
|
||||
asyncTest((done) => {
|
||||
let input = document.getElementById("input");
|
||||
|
||||
input.addEventListener("change", () => {
|
||||
println(input.value);
|
||||
done();
|
||||
});
|
||||
|
||||
internals.sendText(input, "wfh :^)");
|
||||
internals.commitText();
|
||||
})
|
||||
</script>
|
||||
Reference in New Issue
Block a user