Skip to content

feat: Add Screen Wake Lock API support to Page#23619

Draft
Artur- wants to merge 2 commits intomainfrom
wake-lock
Draft

feat: Add Screen Wake Lock API support to Page#23619
Artur- wants to merge 2 commits intomainfrom
wake-lock

Conversation

@Artur-
Copy link
Member

@Artur- Artur- commented Feb 22, 2026

Expose the browser Screen Wake Lock API through Page methods, allowing server-side Java code to prevent the screen from dimming or locking for dashboards, kiosks, and presentations.

Expose the browser Screen Wake Lock API through Page methods,
allowing server-side Java code to prevent the screen from
dimming or locking for dashboards, kiosks, and presentations.
@github-actions
Copy link

github-actions bot commented Feb 22, 2026

Test Results

 1 362 files  +1   1 362 suites  +1   1h 22m 1s ⏱️ -9s
 9 673 tests +4   9 606 ✅ +4  67 💤 ±0  0 ❌ ±0 
10 130 runs  +4  10 054 ✅ +4  76 💤 ±0  0 ❌ ±0 

Results for commit 0535d33. ± Comparison against base commit d16f71e.

♻️ This comment has been updated with latest results.

@sonarqubecloud
Copy link

* listeners registered with {@link #addWakeLockReleaseListener} are
* notified.
*/
public void requestWakeLock() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to have a way to be notified in case of error; for example, an optional callback parameter to be chained to the pending JS invocation. Or return a CompletableFuture

Comment on lines +515 to +517
public PendingJavaScriptResult isWakeLockActive() {
return executeJs("return window.Vaadin.Flow.wakeLock.isActive()");
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about a typed callback parameter instead of returning PendingJavaScriptResult? Or return a CompletableFuture<Boolean>?

if (sentinel !== null) {
return;
}
sentinel = await navigator.wakeLock.request('screen');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to propagate errors to the server so that the developers can immediately react on them, instead of having to do another call to isActive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants