Skip to content

fix(editor): dismiss git-blame tooltip on keydown (MACRO-2664) - #5200

Closed
jbecke wants to merge 2 commits into
mainfrom
jbecke/macro-2664-fix-git-blame-overlay-should-disappear-when-typing
Closed

fix(editor): dismiss git-blame tooltip on keydown (MACRO-2664)#5200
jbecke wants to merge 2 commits into
mainfrom
jbecke/macro-2664-fix-git-blame-overlay-should-disappear-when-typing

Conversation

@jbecke

@jbecke jbecke commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fixes: the git-blame hover overlay in the markdown editor stays visible while the user starts typing over that text, instead of dismissing like it does on pointerleave/pointerdown.
  • Root cause: blameTooltipPlugin.ts only wires up pointermove/pointerleave/pointerdown listeners on the editor root; there's no keydown/input handling at all, so a tooltip left showing from a previous hover has nothing telling it to hide once the user starts editing that spot.
  • Fix: register a KEY_DOWN_COMMAND handler that calls the plugin's existing dismiss() callback, the same one already used for pointerleave/pointerdown.

MACRO-2664

Why prioritized

Reported in bug-reports by Peter ("git blame should disappear when I start typing"), 👍'd by Wolf who owns the blame feature. Small, single-file, self-contained fix; no existing task/PR in flight.

Test plan

  • Added blameTooltipPlugin.test.ts: registers the plugin, dispatches KEY_DOWN_COMMAND, and asserts setState({ hovering: false, nodeId: null }) is called.
  • Verified the test fails against the pre-fix code (temporarily reverted the change locally) and passes with the fix.
  • bunx vitest run src/lib/core/component/LexicalMarkdown/plugins/blame-tooltip/blameTooltipPlugin.test.ts — 1 passed.
  • bunx --bun biome check on both changed files — clean.

Note: bun install fails in this sandbox on the private tauri-plugins/pdf.js git deps, so I couldn't run the full dev server or project-wide type-check — I temporarily stubbed those two deps out locally to install everything else and run the real test suite, then reverted that before committing (no package.json/lockfile changes in this PR). Please give it a real hover-then-type test in dev before merging.


Generated by Claude Code

The per-line git-blame hover overlay only dismissed on
pointerleave/pointerdown, so if it was showing from a prior hover it
kept floating over the text while the user started typing in that
spot. Add a KEY_DOWN_COMMAND handler that dismisses it the same way,
reusing the existing dismiss() callback.
@macro-application

Copy link
Copy Markdown

@notion-workspace

Copy link
Copy Markdown

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 629cced9-258e-4d0d-aacf-b734193322a4

📥 Commits

Reviewing files that changed from the base of the PR and between 767ad19 and f889169.

📒 Files selected for processing (2)
  • apps/web/src/lib/core/component/LexicalMarkdown/plugins/blame-tooltip/blameTooltipPlugin.test.ts
  • apps/web/src/lib/core/component/LexicalMarkdown/plugins/blame-tooltip/blameTooltipPlugin.ts

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes

    • Blame tooltips now automatically dismiss when typing begins.
    • Improved tooltip behavior during IME composition, preventing stale tooltips from remaining visible.
  • Tests

    • Added coverage for keyboard input and IME composition tooltip dismissal behavior.

Walkthrough

The blame tooltip plugin now dismisses on Lexical’s low-priority KEY_DOWN_COMMAND and COMPOSITION_START_COMMAND. New Vitest coverage mounts a Lexical editor, installs the plugin, dispatches each command, and verifies that tooltip hovering is disabled and the targeted node ID is reset.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title follows conventional commits format and clearly matches the tooltip-dismissal change.
Description check ✅ Passed The description is directly related to the markdown editor blame tooltip fix and its tests.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jul 27, 2026

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@apps/web/src/lib/core/component/LexicalMarkdown/plugins/blame-tooltip/blameTooltipPlugin.test.ts`:
- Around line 17-31: Update createTestEditor and the test setup to retain the
plugin teardown returned during registration, and add per-test cleanup that
unregisters the plugin, removes the editor root from document.body, and disposes
the Lexical editor. Ensure cleanup runs after each test so mounted DOM nodes and
listeners do not persist.

In
`@apps/web/src/lib/core/component/LexicalMarkdown/plugins/blame-tooltip/blameTooltipPlugin.ts`:
- Around line 104-114: Update the blame tooltip plugin’s dismissal handling
around the KEY_DOWN_COMMAND registration to also dismiss on composition start or
input events, covering IME paths where KEY_DOWN_COMMAND is skipped. Add a
regression test in blameTooltipPlugin.test.ts alongside the existing keyboard
dismissal tests that shows a tooltip is dismissed when composition begins.
- Around line 104-114: Update the tooltip plugin’s command registrations to also
handle COMPOSITION_START_COMMAND, calling dismiss() and returning false so
tooltips close when IME composition begins. Keep the existing KEY_DOWN_COMMAND
behavior unchanged, and add coverage for composition start in the blame tooltip
plugin test.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: a049a2d4-fc43-40e3-b758-4eef68b5cfa4

📥 Commits

Reviewing files that changed from the base of the PR and between c3ab007 and 767ad19.

📒 Files selected for processing (2)
  • apps/web/src/lib/core/component/LexicalMarkdown/plugins/blame-tooltip/blameTooltipPlugin.test.ts
  • apps/web/src/lib/core/component/LexicalMarkdown/plugins/blame-tooltip/blameTooltipPlugin.ts

…p test

Address CodeRabbit review on #5200:
- KEY_DOWN_COMMAND is skipped while Lexical is composing (IME input), so
  the tooltip could keep showing through an entire composition. Add a
  COMPOSITION_START_COMMAND handler that dismisses it the same way.
- Test now tears down the mounted editor/root and unregisters the
  plugin after each test, and covers the new composition-start path.

jbecke commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review


Generated by Claude Code

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

@jbecke I’ll review the changes in #5200.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@404Wolf

404Wolf commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

I think I already have a fix for this, but I'll take a look at this too

jbecke commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for checking! I searched open PRs by you for anything blame-related and only found #4478 (sync-service refactor, unrelated). If you do have a fix for the dismiss-on-typing behavior specifically, happy to close this one in favor of yours — just point me at it. Otherwise this is a small, self-contained change (adds KEY_DOWN_COMMAND/COMPOSITION_START_COMMAND dismiss handlers to blameTooltipPlugin.ts), so should be easy to reconcile either way.


Generated by Claude Code

@synoet synoet closed this Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants