mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-07 00:29:15 +00:00
LibWeb: Stop radio buttons firing change events when losing focus
This commit is contained in:
parent
75b7a3e413
commit
c75dda8f8b
Notes:
github-actions[bot]
2024-11-22 13:59:41 +00:00
Author: https://github.com/Psychpsyo
Commit: c75dda8f8b
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2501
Reviewed-by: https://github.com/tcl3 ✅
3 changed files with 25 additions and 0 deletions
|
@ -638,6 +638,7 @@ void HTMLInputElement::commit_pending_changes()
|
||||||
case TypeAttributeState::Text:
|
case TypeAttributeState::Text:
|
||||||
case TypeAttributeState::URL:
|
case TypeAttributeState::URL:
|
||||||
case TypeAttributeState::Checkbox:
|
case TypeAttributeState::Checkbox:
|
||||||
|
case TypeAttributeState::RadioButton:
|
||||||
if (!m_has_uncommitted_changes)
|
if (!m_has_uncommitted_changes)
|
||||||
return;
|
return;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
PASS: Change event was not fired
|
|
@ -0,0 +1,23 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<input type="radio" id="radioButton">
|
||||||
|
<script src="include.js"></script>
|
||||||
|
<script>
|
||||||
|
let changeEventFired = false;
|
||||||
|
radioButton.addEventListener("change", () => {
|
||||||
|
changeEventFired = true;
|
||||||
|
});
|
||||||
|
asyncTest(async done => {
|
||||||
|
radioButton.focus();
|
||||||
|
await new Promise(resolve => setTimeout(resolve, 0));
|
||||||
|
radioButton.blur();
|
||||||
|
await new Promise(resolve => setTimeout(resolve, 0));
|
||||||
|
|
||||||
|
if (changeEventFired) {
|
||||||
|
println("FAIL: Change event was fired when it shouldn't have been.");
|
||||||
|
} else {
|
||||||
|
println("PASS: Change event was not fired");
|
||||||
|
}
|
||||||
|
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
</script>
|
Loading…
Add table
Add a link
Reference in a new issue