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

Inconsistent Mouse Cursor over InputText with NavEnableKeyboard #6417

Closed
estrac opened this issue May 9, 2023 · 2 comments
Closed

Inconsistent Mouse Cursor over InputText with NavEnableKeyboard #6417

estrac opened this issue May 9, 2023 · 2 comments
Labels
focus inputtext nav keyboard/gamepad navigation

Comments

@estrac
Copy link

estrac commented May 9, 2023

Configuration

Dear ImGui 1.89.6 WIP (18954)
--------------------------------
sizeof(size_t): 8, sizeof(ImDrawIdx): 2, sizeof(ImDrawVert): 20
define: __cplusplus=199711
define: _WIN32
define: _WIN64
define: _MSC_VER=1935
define: _MSVC_LANG=201402
--------------------------------
io.BackendPlatformName: imgui_impl_glfw
io.BackendRendererName: imgui_impl_opengl3
io.ConfigFlags: 0x00000003
 NavEnableKeyboard
 NavEnableGamepad
io.ConfigInputTextCursorBlink
io.ConfigWindowsResizeFromEdges
io.ConfigMemoryCompactTimer = 60.0
io.BackendFlags: 0x00000006
 HasMouseCursors
 HasSetMousePos
--------------------------------
[snip]

Issue:

With ImGui::GetIO.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard the "edit mouse cursor" is lost after Enter is pressed in ImGui::InputText in the Console example in imgui_demo.cpp. This does not happen when NavEnableKeyboard is off, which I think is desirable because the user still has their mouse in the InputText (see video).

Reproduces in Demo on GLFW+OpenGL3 example in Dear ImGui on Windows, also observed on SDL2+OpenGL3 on Ubunto Linux.

Video:

Dear_ImGui_Edit_Cursor_Issue.mp4

Note that the mouse is moved slightly to restore the edit cursor after it is lost by hitting Enter.

Standalone, minimal, complete and verifiable example:

No new code needed to reproduce

@ocornut ocornut added nav keyboard/gamepad navigation inputtext labels May 9, 2023
@ocornut ocornut changed the title Inconsistent Mouse Cursor Behavior with NavEnableKeyboard Inconsistent Mouse Cursor over InputText with NavEnableKeyboard May 13, 2023
@ocornut ocornut added the focus label Oct 14, 2024
ocornut added a commit that referenced this issue Oct 14, 2024
@ocornut
Copy link
Owner

ocornut commented Oct 14, 2024

This seems to not be general, but caused by the SetKeyboardFocusHere() call in the console code.
It switches to keyboard mode and then in this situation mouse hovering doesn't highlight items anymore.

I have pushed a workaround for it 349af87
I may decide to generalize this a little bit further in the future.

Thanks for reporting and sorry for my late answer!

@ocornut ocornut closed this as completed Oct 14, 2024
@estrac
Copy link
Author

estrac commented Oct 15, 2024

Thanks for the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
focus inputtext nav keyboard/gamepad navigation
Projects
None yet
Development

No branches or pull requests

2 participants