Repository navigation
fix(helpers): don't create the tooltip just to hide it - #43
Merged
Merged
Conversation
tooltip.hide() called prepare(), which constructs the CodeX Tooltips singleton when none exists. Constructing it registers a window scroll listener, and the singleton is only released by an explicit destroy(). ui-kit's popover items call tooltip.hide() from their destroy(), so tearing down a popover whose hints were never shown created a tooltip and left that listener on the page. hide() now does nothing when no tooltip exists. show() and onHover() still create it on first use. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ui-kit bundles the helpers tooltip wrapper into its dist, so it needs a release of its own to ship the tooltip hide() fix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
neSpecc
approved these changes
Oct 19, 2026
1.1.0 only keeps the tooltip's element and window scroll listener while it is shown. ui-kit bundles the tooltip, so this is what ui-kit 2.0.1 ships with. Co-Authored-By: Claude Opus 5.5 <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.
Bug
Destroying a popover that never showed a hint leaves a
windowscrolllistener on the page.tooltip.hide()in@editorjs/helperscalledprepare(), which constructs the CodeX Tooltips singleton when none exists. Constructing it registerswindow.addEventListener('scroll', ...), and the singleton is only released by an explicittooltip.destroy(). ui-kit's popover items calltooltip.hide()from their owndestroy(), so tearing down any popover created a tooltip just to hide it.Found in document-model, where an e2e test checks that destroying an editor removes every
document/windowlistener it added: once the UI plugins destroy their popovers (editor-js/document-model#174), the only listener left behind is this one.Fix
hide()does nothing when no tooltip exists yet.show()andonHover()still create it on first use.@editorjs/helpers1.2.2 → 1.2.3, and@editorjs/ui-kit2.0.0 → 2.0.1, because ui-kit bundles the tooltip wrapper into its own dist.codex-tooltip^1.0.6 → ^1.1.0 (Only hold the element and scroll listener while the tooltip is shown codex-team/codex.tooltips#32). 1.1.0 keeps the tooltip's element andwindowscrolllistener only while it is shown, so a tooltip that was shown no longer outlives every popover. Thehide()fix above covers teardown that never showed a hint; this covers the case where one was shown. ui-kit bundles the tooltip, so 2.0.1 ships with it.Verification
packages/helpers/src/tooltip/tooltip.test.ts(codex-tooltip replaced by a stand-in):hide()with no tooltip, and afterdestroy(), constructs nothing;hide()hides an existing tooltip;show()creates it. The two "constructs nothing" cases fail without the fix.yarn test(198 tests) andyarn buildpass. The changed files are lint-clean; repo-wideyarn lintreports the same 417 errors asmain.codex-tooltip1.1.0 (242 passed; the 2 skipped are Chromium-only accessibility-tree checks).windowlistener and no tooltip element on Chromium and WebKit. The full e2e suite shows no regressions.🤖 Generated with Claude Code