Skip to content

Reaquire wake lock is fired, even when it shouldn't #281

@andolf

Description

@andolf

My use case is this:

I want to request the wake lock when I open a modal, so request is made in conjunction with a button press. When visibility changes, the wake lock is correctly released and then requested again when returning to the tab.

However, even when the modal is not open, the wake lock request is made simply because visibility changes on the document and the hook is rendered because there is no conditional checking whether it should reacquire the wake lock or not, simply that it does because the visibility has changed.

A fix for this would be to supply an a conditional option for when to reacquire on visibility change.

As a working example, check out the official demo over at MDN.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions