From af7c757e631617d81fd8f56ab90adfdddf5984ea Mon Sep 17 00:00:00 2001 From: JonKazama-Hellion Date: Sun, 3 May 2026 22:05:57 +0200 Subject: [PATCH] fix(ui): ImGui ID collisions and missing popup-open trigger - Util/SearchSelector.cs ImRaii.PushId(id) collapsed every row in the filtered list to the same ImGui ID, leaving the ID stack ambiguous for click resolution. Mix the row index into the pushed id so every Selectable has a distinct ImGui identifier - Ui/SettingsTabs/Chat.cs blocked-emote add-button never opened the selector popup because SearchSelector.SelectorPopup is wrapped in ImRaii.ContextPopupItem (right-click semantics). Detect the IsItemClicked() event after the button and call ImGui.OpenPopup explicitly so left-click opens the picker too --- HellionChat/Ui/SettingsTabs/Chat.cs | 7 +++++++ HellionChat/Util/SearchSelector.cs | 6 +++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/HellionChat/Ui/SettingsTabs/Chat.cs b/HellionChat/Ui/SettingsTabs/Chat.cs index 99ee8f9..be246b0 100644 --- a/HellionChat/Ui/SettingsTabs/Chat.cs +++ b/HellionChat/Ui/SettingsTabs/Chat.cs @@ -169,6 +169,13 @@ internal sealed class Chat : ISettingsTab using (Plugin.FontManager.FontAwesome.Push()) ImGui.Button(FontAwesomeIcon.Plus.ToIconString(), new Vector2(buttonWidth, 0)); + // Open the selector popup on left-click; SelectorPopup uses + // ImRaii.ContextPopupItem internally which only opens on right- + // click otherwise — without this OpenPopup the button looked + // active but the popup never appeared on a normal click. + if (ImGui.IsItemClicked()) + ImGui.OpenPopup("WordAddPopup"); + if (SearchSelector.SelectorPopup("WordAddPopup", out var newWord, WordPopupOptions)) { Mutable.BlockedEmotes.Add(newWord); diff --git a/HellionChat/Util/SearchSelector.cs b/HellionChat/Util/SearchSelector.cs index 3219467..7d19770 100644 --- a/HellionChat/Util/SearchSelector.cs +++ b/HellionChat/Util/SearchSelector.cs @@ -84,7 +84,11 @@ public static class SearchSelector foreach (var i in clipper.Rows) { var searched = FilteredSearchSheet[i]; - using var pushedId = ImRaii.PushId(id); + // Mix the row index into the ImGui ID so each Selectable in + // the loop has a distinct ID — using the same id for every + // row collapsed all rows to a single ID-stack entry and made + // selection ambiguous. + using var pushedId = ImRaii.PushId($"{id}##{i}"); if (!drawSelectable(searched, options.IsSelected(searched))) continue;