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

Keyboard navigation two items focused at the same time with Ctrl+Tab #2380

Closed
tomasiser opened this issue Feb 24, 2019 · 2 comments
Closed
Labels
bug inputtext nav keyboard/gamepad navigation

Comments

@tomasiser
Copy link

Version/Branch of Dear ImGui:

Version: 1.69 WIP
Branch: master (6f80179)

Back-end/Renderer/Compiler/OS

Back-ends: example_glfw_opengl3

My Issue/Question:

Consider watching the gif, it is less complicated.

  1. Run the example from the latest master.
  2. In the ImGui Demo window, check NavEnableKeyboard.
  3. Open Widgets -> Basic and click inside Hello, world! input.
  4. Now in the other window, double click inside an input (e.g., G of the clear color). This should focus and active the input in the other window.
  5. Press Ctrl+Tab to focus to the demo window again.
  6. Notice that the focus (blue rectangle) gets into the demo window and the Hello, world! input, but the input box in the other window is still active and all keyboard events get passed to this unfocused input.

Screenshots/Video

image

imguiwrongfocus

@ocornut ocornut added inputtext nav keyboard/gamepad navigation bug labels Feb 24, 2019
@ocornut
Copy link
Owner

ocornut commented Feb 24, 2019

Thank you Tomáš, I confirmed as a bug (it is also a surprisingly old bug).

There's two aspect to the fix,

  • The // Apply final focus section of NavUpdateWindowing() should probably call ClearActiveID().
  • InputTextEx() should be able to detect better that its active id has been stolen (there are a few tests in there that are rather short sighted), for things like InputText, InputInt, InputFloat: add ImGuiInputTextFlags_NoLiveEdit flag #701 and maybe other reasons, will need to investigate this a little.

Will look it shortly.

ocornut added a commit that referenced this issue Mar 5, 2019
@ocornut
Copy link
Owner

ocornut commented Mar 5, 2019

I pushed a fix for this (and wrote a test for it).

@ocornut ocornut closed this as completed Mar 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug inputtext nav keyboard/gamepad navigation
Projects
None yet
Development

No branches or pull requests

2 participants