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

Single line TextEdit ignores input after repeated calls to request_focus() #5187

Open
rustingcode opened this issue Sep 29, 2024 · 2 comments
Labels
bug Something is broken native-linux Problem specific to Linux

Comments

@rustingcode
Copy link

rustingcode commented Sep 29, 2024

Describe the bug
Attempting to call request_focus() on a single line text edit every time it loses focus will eventually cause the TextEdit to ignore any further key presses.

This happens on native build (egui 0.29) for Linux with eframe. Have not tested on MacOS or Windows. Does not occur on webassembly build (tested in firefox)

To Reproduce
Steps to reproduce the behavior:

  1. Checkout the latest eframe_template (using egui 0.29)
  2. Replace this line:
    ui.text_edit_singleline(&mut self.label);
    with this block (the point being to restore focus on the input field every time after pressing enter):
    let response = ui.text_edit_singleline(&mut self.label); if !response.has_focus() { response.request_focus(); }
  3. Run the demo and type something in the test box and hit enter
  4. Notice that focus was restored to the text box
  5. Type some more characters, then hold down the enter key for a few seconds
  6. Try to type some more characters
  7. Notice that the text field now ignores all further input (if problem doesn't yet occur, repeat step 5 - this is reproducible every time on my system after a few attempts at most)

Expected behavior
Regardless of how many times the text box loses focus due to pressing enter, the focus should still be restored and the text box should accept further input.

Desktop (please complete the following information):
Tested on Linux Mint with egui 0.29

Problem does not occur on wasm build (tested in Firefox)

@rustingcode rustingcode added the bug Something is broken label Sep 29, 2024
@emilk emilk added this to the Next Patch Release milestone Sep 30, 2024
@emilk emilk added the native-linux Problem specific to Linux label Sep 30, 2024
@emilk
Copy link
Owner

emilk commented Sep 30, 2024

Please check if this was solved by

@emilk emilk removed this from the Next Patch Release milestone Oct 1, 2024
@rustingcode
Copy link
Author

Please check if this was solved by

* [Linux: Disable IME to fix backspace/arrow keys #5188](https://github.com/emilk/egui/pull/5188)

I tested again with the fix for #5188 but that update doesn't resolve this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken native-linux Problem specific to Linux
Projects
None yet
Development

No branches or pull requests

2 participants