mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 06:32:30 +02:00
LibWeb: Return body from activeElement() when nothing is focused
This matches the behavior of other browsers.
This commit is contained in:
committed by
Andreas Kling
parent
4a5350a2ee
commit
0035690977
Notes:
github-actions[bot]
2026-02-06 11:26:03 +00:00
Author: https://github.com/tcl3 Commit: https://github.com/LadybirdBrowser/ladybird/commit/00356909776 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/7525 Reviewed-by: https://github.com/awesomekling
13
Tests/LibWeb/Text/input/html/activeElement-body.html
Normal file
13
Tests/LibWeb/Text/input/html/activeElement-body.html
Normal file
@@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<body>
|
||||
<script src="../include.js"></script>
|
||||
<div id="content">Test content</div>
|
||||
<script>
|
||||
test(() => {
|
||||
// When nothing is explicitly focused, activeElement should return the body element
|
||||
println("document.activeElement === document.body: " + (document.activeElement === document.body));
|
||||
println("document.activeElement is null: " + (document.activeElement === null));
|
||||
println("document.activeElement tagName: " + (document.activeElement ? document.activeElement.tagName : "null"));
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
Reference in New Issue
Block a user