Skip to content

fix: keep a click landing as a tooltip arms on its button - #1256

Merged
xHeaven merged 1 commit into
dev-null-sh:productionfrom
jubianchi:fix/tooltip-click-while-arming
Oct 29, 2026
Merged

xHeaven merged 1 commit into
dev-null-sh:productionfrom
jubianchi:fix/tooltip-click-while-arming

Conversation

@jubianchi

@jubianchi jubianchi commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Since tooltips mount on first hover (#1150), a click that follows the pointer onto a button right away can get lost: the tooltip mounts the button again between the press and the release, so the browser fires no click. In WebKit, clicking a commit's delete button right after hovering it lost 15 clicks out of 20.

Changes

  • The tooltip now arms synchronously (flushSync) when the pointer enters or the keyboard focuses its trigger, so the button is mounted again before the press lands on it. React otherwise renders after a pointerenter later, as a continuous event.

Validation

  • Playwright, WebKit, hovering then clicking a commit's delete button, 20 times: 15 lost clicks on production, none on this branch.
  • Still working, in Chrome and WebKit: tabbing onto the composer's buttons shows their tooltips and keeps the focus, in the page and in the commit dialog's focus trap; a click on a button wrapped by ActionTooltip acts at once; deleting a commit confirms after one click.
  • tsc, lint, format, node tests (206) and Vitest (722) pass locally. No PHP change.
  • My Playwright suite for the graph (not part of the PR): 497/497 in Chrome. In WebKit, the scenarios that used to time out on a lost click now run; what still fails there fails on production too (a ResizeObserver loop warning, WebKit's history.replaceState rate limit).

Independent review

Separate Claude agent, base fa8d5407, head e580215f (same tree as cbd6fb81, only the commit footer removed since): CODE: PASS, VISUAL: N/A (only when the tooltip renders changes, not what it shows). Its one suggestion, tabbing onto a tooltip button inside a modal's focus trap, is checked above.

Limitations

  • No unit test: the unit tests have no DOM, and the bug needs real pointer events.

Summary by CodeRabbit

  • Bug Fixes
    • Tooltips now update their armed state immediately, helping the tooltip respond more consistently when activated.

A tooltip mounts once a pointer enters its trigger, mounting the trigger
again. React renders that later than the pointer entering, so a click
following it at once could press the old trigger and be released on the
new one, and the browser fired no click: in WebKit, a click on the
commit's delete button right after the pointer reached it was lost about
one time in five. The tooltip now arms at once, before the press.

Not unit-tested: the unit tests have no DOM. Checked with Playwright in
WebKit, clicking the delete button as the pointer reaches it: 3 lost
clicks in 15 before, none after; tabbing onto the composer's buttons
still shows their tooltips.
@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 731cc136-5146-448d-8301-4cde0c40bfdd
Commits

Reviewing files that changed from the base of the PR and between fa8d540 and cbd6fb8.

Files selected for processing: 1
  • resources/js/components/ui/tooltip.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

Walkthrough

The tooltip component now uses React DOM’s flushSync to update its armed state synchronously when arm runs.

Changes: Tooltip Arming

Layer / File(s) Summary
Synchronous tooltip arming
resources/js/components/ui/tooltip.tsx
arm now wraps the armed-state update in flushSync.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Possibly related PRs

Suggested reviewers: xheaven

Merge Risk: Minimal · up to cbd6f

The synchronous tooltip arming change has no established merge-blocking risk.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: preserving clicks when a tooltip arms synchronously on its button.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
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.
Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 1 files.

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@jubianchi
jubianchi marked this pull request as ready for review October 28, 2026 07:16
@xHeaven
xHeaven merged commit b0d13be into dev-null-sh:production Oct 29, 2026
1 check passed
richardkeep pushed a commit to richardkeep/dev-null.sh that referenced this pull request Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants