Commit Graph

5 Commits

Author SHA1 Message Date
Adam Colvin
ef3991f1ed LibWeb: Implement Document.hasFocus() per specification
Previously, Document::has_focus() always returned true, which was
incorrect. This caused documents without a browsing context (such as
those created via document.implementation.createHTMLDocument()) to
incorrectly report that they had focus.

The implementation now follows the spec:
1. Return false if the document has no navigable
2. Return false if the top-level traversable doesn't have system focus
3. Walk the focus chain from the top-level document to verify this
   document is actually focused

This fixes a WPT test: "The hasFocus() method must return false if the
Document has no browsing context"
2026-01-31 15:13:54 +01:00
Tim Ledbetter
0035690977 LibWeb: Return body from activeElement() when nothing is focused
This matches the behavior of other browsers.
2026-01-19 13:08:30 +01:00
Lorenz A
bd56fdc57b LibWeb: Allow focusable for the first summary child of a detail element 2025-11-12 13:57:05 +01:00
Lorenz A
8ca59e7c7e LibWeb: AnchorElement should be focusable with tabindex 2025-11-12 13:57:05 +01:00
Lorenz A
3bc061d028 LibWeb: Allow all elements with tabindex attribute to be focusable 2025-11-12 13:57:05 +01:00