Skip to content

ImGui Window navigable by keyboard despite NavEnableKeyboard set to false #5504

@AdrienTD

Description

@AdrienTD

Version/Branch of Dear ImGui:

Version: 1.89 WIP (18805) 2d38bc9
Branch: master
(latest commit as of writing)

Back-end/Renderer/Compiler/OS

Back-ends: imgui_impl_dx12.cpp + imgui_impl_win32.cpp
Compiler: Visual Studio 2022
Operating System: Windows 10 21H2

My Issue/Question:

In the latest commits of the master and docking branch, the windows are navigable even if the NavEnableKeyboard flag in ImGui::GetIO().ConfigFlags is not set. If you last clicked on a scrollable window, then pressing the Up/Down arrow buttons will still navigate through the items and eventually the windows will scroll, even though the selection is not drawn. Also pressing Right can expand trees.
When checking the Metrics/Debugger window and going to Internal State > NAV,FOCUS, the NavId pointer changes when pressing the Up/Down keys.
Note that this bug was not present in the stable release v1.88, here the navigation is disabled when NavEnableKeyboard is not set as expected, and the NavId pointer doesn't change when pressing the keys.

Screenshots/Video

IGNavBug
You can see the NavID changes when pressing Up/Down keys, even though the navigation selection is invisible.

Standalone, minimal, complete and verifiable example:

  • Open the ImGui example at examples/example_win32_directx12
  • In Configuration, ensure that io.ConfigFlags: NavEnableKeyboard is unchecked
  • Expand all collapsing headers in the Dear ImGui Demo window
  • Press Up/Down arrow buttons long enough until the window scrolls

Since I initially discovered the bug on a custom backend (mix of SDL2 and my own rendering abstraction layer), I do strongly believe it might apply to other backends as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugnavkeyboard/gamepad navigation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions