fix(inspector): stop multiple tooltips stacking in shared tooltip#2144
Merged
Conversation
) 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.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
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
Tooltipsingleton (#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, sohoverendnever 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-referenceelements inside the same#layout-tooltip, with stale content (clearColorBufferfrom a Camera,typefrom 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:hoverremoves whatever was shown before (_shown) prior to appending the new container, and checkscontainer.parent !== thisinstead of a per-closureappendedflag, so it is immune to stale flags.hoverendbails 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.detachclears_shownwhen it held the detached container.This does not depend on fields emitting
destroyon 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 typecheckclean.