Skip to content

fix(example): disambiguate Drop Target button IDs in Drag'N'Drop demo#387

Merged
SpaiR merged 1 commit intoSpaiR:mainfrom
phraktle:fix/example-dragdrop-id-conflicts
Apr 21, 2026
Merged

fix(example): disambiguate Drop Target button IDs in Drag'N'Drop demo#387
SpaiR merged 1 commit intoSpaiR:mainfrom
phraktle:fix/example-dragdrop-id-conflicts

Conversation

@phraktle
Copy link
Copy Markdown
Contributor

Summary

  • The Drag'N'Drop demo renders three drop-target buttons whose labels all come from the same mutable data field, so imgui hashes three identical item IDs inside the window.
  • This was silently broken before 1.91 (drop zones shared hover/active state) and now surfaces as a visible "3 visible items with conflicting ID!" warning because imgui 1.91's ConfigDebugHighlightIdConflicts is on by default in debug builds.
  • Wrap each drop-target block with 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

  • Minor changes or tweaks (quality of life stuff)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Test plan

  • Run ./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.

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>
@SpaiR SpaiR added the fix Fixes problems label Apr 21, 2026
@SpaiR SpaiR merged commit 7c06865 into SpaiR:main Apr 21, 2026
7 checks passed
@phraktle phraktle deleted the fix/example-dragdrop-id-conflicts branch April 21, 2026 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Fixes problems

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants