Skip to content

fix(inspector): stop multiple tooltips stacking in shared tooltip#2144

Merged
kpal81xd merged 1 commit into
mainfrom
fix/inspector-multiple-tooltips
Jul 8, 2026
Merged

fix(inspector): stop multiple tooltips stacking in shared tooltip#2144
kpal81xd merged 1 commit into
mainfrom
fix/inspector-multiple-tooltips

Conversation

@kpal81xd

@kpal81xd kpal81xd commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Closes #2133

Problem

After some time working in the editor, multiple reference tooltips start appearing stacked when hovering over inspector fields (see #2133).

The inspector's reference tooltips all share a single Tooltip singleton (#layout-tooltip). On hover, each field appends its own content container into the singleton and shows it. When you switch entities, the old field is torn down without a mouseout, so hoverend never fires and the field's container is never removed. Over a session these orphaned containers pile up inside the one singleton and render stacked.

Diagnostics confirmed both visible boxes were .tooltip-reference elements inside the same #layout-tooltip, with stale content (clearColorBuffer from a Camera, type from a Light) while the inspector showed an unrelated component.

Fix

Enforce the missing invariant directly on the singleton — it shows at most one content container at a time — in src/common/pcui/element/element-tooltip.ts:

  • hover removes whatever was shown before (_shown) prior to appending the new container, and checks container.parent !== this instead of a per-closure appended flag, so it is immune to stale flags.
  • hoverend bails if a later hover has taken the singleton over (_shown !== container), which also fixes a pre-existing race where moving between fields could hide the wrong tooltip.
  • detach clears _shown when it held the detached container.

This does not depend on fields emitting destroy on teardown (they don't, on entity switch), so any lingering container is cleared on the next hover and two can never coexist.

Testing

  • npm run typecheck clean.
  • Manual: reproduced the stacked tooltips by flipping selection while hovering an inspector field; after the change only one tooltip is ever shown.

)

The inspector's reference tooltips all share one Tooltip singleton. Each
field appended its own content container on hover; a field destroyed while
its tooltip was up never fired hoverend, so its container lingered and
stacked with the next one shown.

Enforce one-container-at-a-time on the singleton via _shown, checked by DOM
parentage rather than a per-closure flag, so it is immune to fields being
torn down without a destroy event.
@vercel

vercel Bot commented Jul 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
editor Ready Ready Preview, Comment Jul 8, 2026 2:33pm

Request Review

@kpal81xd kpal81xd self-assigned this Jul 8, 2026
@kpal81xd kpal81xd added the bug Something isn't working label Jul 8, 2026
@kpal81xd kpal81xd merged commit e1a388d into main Jul 8, 2026
7 checks passed
@kpal81xd kpal81xd deleted the fix/inspector-multiple-tooltips branch July 8, 2026 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inspector multiple Tooltips

1 participant