Search code examples
javascripthtmlpage-lifecycle

Page Lifecycle API


This article about Page Lifecycle API states that a webpage comes in Passive state when it has "A page is in the passive state if it is visible and does not have input focus."

I don't understand how come a page is visible but does not have input focus. How's that possible?


Solution

  • From the article you posted:

    "Note: A focus event does not necessarily signal a state change. It only signals a state change if the page did not previously have input focus."

    Also from MDN about the focus event, "The focus event fires when an element has received focus. The main difference between this event and focusin is that focusin bubbles while focus does not.

    The opposite of focus is blur."

    Basically, its when someone starts interacting with the page.