Skip to content

Conversation

ardocrat
Copy link
Contributor

@ardocrat ardocrat commented May 21, 2025

When your press a Back button on Android (for example at native-activity), Winit translates this key as NamedKey::BrowserBack. Added convertion to Key::Escape at egui-winit module.

Copy link

Preview available at https://egui-pr-preview.github.io/pr/7073-backbuttonandroid
Note that it might take a couple seconds for the update to show up after the preview_build workflow has completed.

@ardocrat
Copy link
Contributor Author

I think Key::Escape is more reliable in case with NamedKey::BrowserBack or we can create new key like Key::Back, what do you think @emilk @lucasmerlin ?

@lucasmerlin
Copy link
Collaborator

Hmm, I think a new back key would be nicer. There are some cases where I'd expect pressing back and pressing escape to do different things. E.g. pressing escape should clear focus while pressing back should take you back to the previous page even if something is focused.

@lucasmerlin lucasmerlin added egui egui-winit porblems related to winit feature New feature or request labels Jun 2, 2025
@ardocrat
Copy link
Contributor Author

ardocrat commented Jun 5, 2025

Added Key::BrowserBack as last at Keys, cause there is no groups for multimedia/navigation keys to support full keyboard layout from winit.

Copy link
Collaborator

@lucasmerlin lucasmerlin left a comment

Choose a reason for hiding this comment

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

Nice!

@emilk emilk merged commit 742da95 into emilk:main Jun 15, 2025
26 checks passed
jb55 pushed a commit to damus-io/egui that referenced this pull request Jul 17, 2025
When your press a Back button on Android (for example at
`native-activity`), [Winit translates this
key](https://github.com/rust-windowing/winit/blob/47b938dbe78702d521c2c7a43b6f741a3bb8cb0b/src/platform_impl/android/keycodes.rs#L237C42-L237C53)
as `NamedKey::BrowserBack`. Added convertion to `Key::Escape` at
`egui-winit` module.

---------

Co-authored-by: Advocat <[email protected]>
jb55 pushed a commit to damus-io/egui that referenced this pull request Jul 19, 2025
When your press a Back button on Android (for example at
`native-activity`), [Winit translates this
key](https://github.com/rust-windowing/winit/blob/47b938dbe78702d521c2c7a43b6f741a3bb8cb0b/src/platform_impl/android/keycodes.rs#L237C42-L237C53)
as `NamedKey::BrowserBack`. Added convertion to `Key::Escape` at
`egui-winit` module.

---------

Co-authored-by: Advocat <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

egui egui-winit porblems related to winit feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants