fix(example): disambiguate Drop Target button IDs in Drag'N'Drop demo#387
Merged
SpaiR merged 1 commit intoSpaiR:mainfrom Apr 21, 2026
Merged
Conversation
The demo renders three drop-target buttons whose labels share the same
value of the mutable 'data' field, so imgui hashes three identical
item IDs within the same window. This was silently broken pre-1.91
(drop zones shared hover/active state) and surfaces as a visible
"3 visible items with conflicting ID!" warning now that imgui 1.91's
ConfigDebugHighlightIdConflicts is on by default in debug builds.
Wrap each drop-target block in a PushID("any"/"string"/"class") /
PopID() pair so the buttons share a human-readable label but are
distinguished in the ID stack. This is the resolution imgui's own
warning recommends first.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
datafield, so imgui hashes three identical item IDs inside the window.ConfigDebugHighlightIdConflictsis on by default in debug builds.PushID("any"/"string"/"class")/PopID()so buttons share a human-readable label but are distinguished in the ID stack — the resolution imgui's own warning recommends first.Type of change
Test plan
./gradlew :example:run, open the Drag'N'Drop demo window, hover each drop-target button — warning overlay no longer appears and hover highlight is per-button.