Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Demo keyboard input "p" not working #2739

Closed
jiricodes opened this issue Feb 14, 2023 · 3 comments · Fixed by #2740
Closed

Demo keyboard input "p" not working #2739

jiricodes opened this issue Feb 14, 2023 · 3 comments · Fixed by #2740

Comments

@jiricodes
Copy link

Short Description

In the deployed egui demo the character p is being ignored in some TextEdit fields.

Expected behaviour

Press P on keyboard and a p character appears in selected editable field.
Press Shift + P on keyboard and a P character appears in selected editable field.

Observed behaviour

The keyboard input P is ignored in following fields:

  • Demos
    • Code Editor
    • Code Example
    • Font Book
    • Misc Demos - password
      • [ Desktop ] works as expected until visibility is toggled on or off
        • gets fixed by selecting all the text and deleting it
        • one by one character deletion doesn't fix
    • TextEdit
      • [ Desktop ] - buttons start and end seems to fix things, making the 'P' key being registered as expected. Until the cursor is moved manually. (maybe a hint towards the root cause?)
    • Window Options
  • EasyMark

These fields work as expected:

Note of inconsistency - when testing, spamming key p while changing TextEdit field selection resulted in registering the character occasionally in either of the fields (sometimes in the just selected and sometime in the just deselected)

Native build of egui_demo_app (master branch) locally works fine.

Tested Platforms

  • Desktop: Ubuntu 22.04.1 LTS
    • Chrome (Version 110.0.5481.77 (Official Build) (64-bit))
    • Firefox (109.0.1 (64-bit))ppp
  • Mobile: iOS 16.2
    • Safari
    • Chrome
@YgorSouza
Copy link
Contributor

Apparently the reason is this:

let prevent_default = if egui_key == Some(Key::Tab) {
// Always prevent moving cursor to url bar.
// egui wants to use tab to move to the next text field.
true
} else if egui_key == Some(Key::P) {
true // Prevent ctrl-P opening the print dialog. Users may want to use it for a command palette.

This code should probably check for modifiers. For Windows and Linux it's Ctrl, and for macOS I guess it's Command? But I am not sure.

@emilk
Copy link
Owner

emilk commented Feb 14, 2023

Oh wow, this is embarrassing 🤦

Yes, should be a very easy fix to check for modifers when we ignore keys.

@emilk
Copy link
Owner

emilk commented Feb 15, 2023

eframe 0.21.3 released with fix

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 a pull request may close this issue.

3 participants