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

Nav: Pressing Alt deactivates widget when nav inputs are disabled with ImGuiWindowFlags_NoNavInputs #8231

Closed
petrihakkinen opened this issue Dec 16, 2024 · 4 comments
Labels
bug inputs menus menu bars, menu items nav keyboard/gamepad navigation

Comments

@petrihakkinen
Copy link

Version/Branch of Dear ImGui:

Version 1.91.7 (WIP), Branch: master

Back-ends:

imgui_impl_win32.cpp + imgui_impl_dx10.cpp

Compiler, OS:

Windows 10 + MSVC 2022

Full config/build information:

Dear ImGui 1.91.7 WIP (19161)
--------------------------------
sizeof(size_t): 8, sizeof(ImDrawIdx): 2, sizeof(ImDrawVert): 20
define: __cplusplus=199711
define: _WIN32
define: _WIN64
define: _MSC_VER=1941
define: _MSVC_LANG=201402
--------------------------------
io.BackendPlatformName: imgui_impl_win32
io.BackendRendererName: imgui_impl_dx10
io.ConfigFlags: 0x00000003
 NavEnableKeyboard
 NavEnableGamepad
io.ConfigNavCaptureKeyboard
io.ConfigInputTextCursorBlink
io.ConfigWindowsResizeFromEdges
io.ConfigMemoryCompactTimer = 60.0
io.BackendFlags: 0x0000000E
 HasMouseCursors
 HasSetMousePos
 RendererHasVtxOffset
--------------------------------
io.Fonts: 1 fonts, Flags: 0x00000000, TexSize: 512,128
io.DisplaySize: 1264.00,761.00
io.DisplayFramebufferScale: 1.00,1.00
--------------------------------
style.WindowPadding: 8.00,8.00
style.WindowBorderSize: 1.00
style.FramePadding: 4.00,3.00
style.FrameRounding: 0.00
style.FrameBorderSize: 0.00
style.ItemSpacing: 8.00,4.00
style.ItemInnerSpacing: 4.00,4.00

Details:

An ImGui window that sets the ImGuiWindowFlags_NoNavInputs flag still reacts to Alt being pressed by deactivating the current widget. I would expect all nav inputs (including Alt) to be disabled in this case.

Repro: open the demo window and check "No nav" in Window options. Click any input text box. Press Alt and observe that the widget is deactivated.

Screenshots/Video:

No response

Minimal, Complete and Verifiable Example code:

No response

@ocornut ocornut added bug nav keyboard/gamepad navigation menus menu bars, menu items inputs labels Dec 16, 2024
ocornut added a commit that referenced this issue Dec 16, 2024
…windows with the ImGuiWindowFlags_NoNavInputs flag. (#8231)
@ocornut
Copy link
Owner

ocornut commented Dec 16, 2024

Hello,
Thanks for your report. I have pushed a fix: 13c4084

Please note that there is now an input ownership/routing mechanism, so I am curious to know about the particular reason you may be using ImGuiWindowFlags_NoNavInputs, because specific nav keys/features can also be disabled via this mechanism.

@petrihakkinen
Copy link
Author

That was fast, thank you! :)

This is a rather large codebase with ~50 places where ImGuiWindowFlags_NoNav / ImGuiWindowFlags_NoNavInputs is used. From the top of my head it's hard to say what are the reasons for disabling nav, but I suspect there are historical reasons. We are also running a few releases behind.

@ocornut
Copy link
Owner

ocornut commented Dec 16, 2024

Alright, for now I'll close this but don't hesitate to discuss this internally or get back to me for advices.

@ocornut ocornut closed this as completed Dec 16, 2024
ocornut added a commit to ocornut/imgui_test_engine that referenced this issue Dec 16, 2024
@ocornut
Copy link
Owner

ocornut commented Dec 16, 2024

Added a basic test for it too ocornut/imgui_test_engine@f881a75

matthew-mccall pushed a commit to matthew-mccall/imgui that referenced this issue Jan 1, 2025
…windows with the ImGuiWindowFlags_NoNavInputs flag. (ocornut#8231)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug inputs menus menu bars, menu items nav keyboard/gamepad navigation
Projects
None yet
Development

No branches or pull requests

2 participants