Skip to content

wpeview: Let Android handle the volume keys and Back - #343

Merged
juanjosanchez merged 1 commit into
mainfrom
system-keys
Oct 23, 2026
Merged

juanjosanchez merged 1 commit into
mainfrom
system-keys

Conversation

@juanjosanchez

Copy link
Copy Markdown
Collaborator

WebView sends every key to the page and reports it as handled, so Android does not get the volume keys while the page has the focus. For example, the volume buttons do nothing while a YouTube video plays in Wolvic WPE. For the same reason, Wolvic WPE has to catch Back before it reaches the WebView.

This leaves the volume keys, Back, Forward, Menu, Search and the headset button to Android, as GeckoView does in GeckoEditable.shouldProcessKey(). The page no longer gets these keys.

Tested on a Pixel 7a with WPE WebKit 2.55.0.6: the wpeview instrumented tests pass, 25 in all, including a new one that fails without this change. In Wolvic WPE, the volume buttons now change the media volume while a YouTube video plays.

WebView sends every key to the page and reports it as handled, so
Android does not get the volume keys while the page has the focus, and
they do not change the volume, for example while a video plays.
Embedders have to catch Back before it reaches the WebView for the
same reason.

As GeckoView does, do not send the volume keys, Back, Forward, Menu,
Search and the headset button to the page, and leave them to the app
and the system.

Add a test that these keys are neither consumed nor sent to the page,
while other keys still are.

@alexgcastro alexgcastro left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM!

@juanjosanchez
juanjosanchez merged commit 5660b5e into main Oct 23, 2026
6 checks passed
@juanjosanchez
juanjosanchez deleted the system-keys branch October 23, 2026 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants