Skip to content

servoshell: Do not forward key events to egui when no widget is focused#41314

Merged
atbrakhi merged 1 commit intoservo:mainfrom
mrobinson:do-not-forward-keyboard-events-when-no-egui-focus
Dec 16, 2025
Merged

servoshell: Do not forward key events to egui when no widget is focused#41314
atbrakhi merged 1 commit intoservo:mainfrom
mrobinson:do-not-forward-keyboard-events-when-no-egui-focus

Conversation

@mrobinson
Copy link
Copy Markdown
Member

When no egui widget is focused, the WebView itself is effectively
focused, so we should not forward keyboard events to egui. This change
does that as well as switch the key processing function in Gui to use
an early return approach for all events that should go immediately to
the WebView or are otherwise consumed.

Eventually, key events that are not consumed by the WebView should be
forwarded back to egui, so that the user can, for instance, tab out of
the WebView, but this requires having a version of winit with:
rust-windowing/winit#4026

Testing: This level of servoshell is untested unfortunately so no tests are added.
Fixes: #41307.

When no egui widget is focused, the `WebView` itself is effectively
focused, so we should not forward keyboard events to egui. This change
does that as well as switch the key processing function in `Gui` to use
an early return approach for all events that should go immediately to
the `WebView` or are otherwise consumed.

Eventually, key events that are not consumed by the `WebView` should be
forwarded back to `egui`, so that the user can, for instance, tab out of
the `WebView`, but this requires having a version of winit with:
rust-windowing/winit#4026

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
@mrobinson mrobinson requested a review from atbrakhi as a code owner December 16, 2025 11:13
@servo-highfive servo-highfive added the S-awaiting-review There is new code that needs to be reviewed. label Dec 16, 2025
@servo-highfive servo-highfive removed the S-awaiting-review There is new code that needs to be reviewed. label Dec 16, 2025
@atbrakhi atbrakhi added this pull request to the merge queue Dec 16, 2025
@servo-highfive servo-highfive added the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Dec 16, 2025
Merged via the queue into servo:main with commit 954c385 Dec 16, 2025
32 checks passed
@servo-highfive servo-highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Dec 16, 2025
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.

keydown event doesn't fire for the Tab key

4 participants