diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 696e4dbc..1ece04d6 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -63,6 +63,7 @@ Other Changes: - Disabled: disabled items set HoveredId, allowing e.g. HoveredIdTimer to function. (#211, #3419) [@rokups] - Disabled: disabled mode more consistently release active id if the active item got disabled. (#211) - Disabled: disabled mode doesn't prevent Selectable() from looking selected. (#211) +- Disabled: fixed IsItemHovered() returning true on disabled item when navigated to. (#211) - Fixed printf-style format checks on non-MinGW flavors. (#4183, #3592) - Fonts: Functions with a 'float size_pixels' parameter can accept zero if it is set in ImFontSize::SizePixels. - Fonts: Prefer using U+FFFD character for fallback instead of '?', if available. (#4269) diff --git a/imgui.cpp b/imgui.cpp index 80fb4bca..8ae49a84 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -3162,7 +3162,11 @@ bool ImGui::IsItemHovered(ImGuiHoveredFlags flags) ImGuiContext& g = *GImGui; ImGuiWindow* window = g.CurrentWindow; if (g.NavDisableMouseHover && !g.NavDisableHighlight) + { + if ((g.CurrentItemFlags & ImGuiItemFlags_Disabled) && !(flags & ImGuiHoveredFlags_AllowWhenDisabled)) + return false; return IsItemFocused(); + } // Test for bounding box overlap, as updated as ItemAdd() ImGuiItemStatusFlags status_flags = window->DC.LastItemStatusFlags;