mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-09 23:54:20 +00:00
Disabled, ButtonBehavior: fixed a bug when a previously enabled item that got nav focus and then turns disabled could still be activated using keyboard. (#9036)
ButtonBehavior() was relying on lack of nav focus for keyboard handling
This commit is contained in:
parent
7c483a0eba
commit
9753c741b9
3 changed files with 5 additions and 2 deletions
|
|
@ -675,6 +675,7 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
|
|||
|
||||
// Keyboard/Gamepad navigation handling
|
||||
// We report navigated and navigation-activated items as hovered but we don't set g.HoveredId to not interfere with mouse.
|
||||
if ((item_flags & ImGuiItemFlags_Disabled) == 0)
|
||||
{
|
||||
if (g.NavId == id && g.NavCursorVisible && g.NavHighlightItemUnderNav)
|
||||
if (!(flags & ImGuiButtonFlags_NoHoveredOnFocus))
|
||||
|
|
@ -756,7 +757,7 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
|
|||
}
|
||||
|
||||
// Activation highlight (this may be a remote activation)
|
||||
if (g.NavHighlightActivatedId == id)
|
||||
if (g.NavHighlightActivatedId == id && (item_flags & ImGuiItemFlags_Disabled) == 0)
|
||||
hovered = true;
|
||||
|
||||
if (out_hovered) *out_hovered = hovered;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue