Skip to content

fix(Tooltip): skip repeated hover delays between neighbouring triggers - #10858

Draft
SemihSan wants to merge 1 commit into
meta:mainfrom
SemihSan:fix/tooltip-hover-intent
Draft

SemihSan wants to merge 1 commit into
meta:mainfrom
SemihSan:fix/tooltip-hover-intent

Conversation

@SemihSan

@SemihSan SemihSan commented Nov 9, 2026

Copy link
Copy Markdown

User impact

Scanning a row of icon buttons currently means waiting for every tooltip separately. This keeps the first hover delay, then opens the next hint immediately while the previous one is still within its hover bridge. Moving on closes the previous hover preview; leaving beyond the bridge restores the delay.

Refs #8934. This is a draft while the scope question on the issue is open: Tooltip is the first consumer, with HoverCard and menu adoption left for follow-ups.

Problem and solution fit

useTooltip owns separate timers today, so neighbouring triggers cannot share intent. The internal HoverGestureRecognizer owns entry and exit timing and shares an active group per document through the existing realm registry. It adds no listeners, touch handling, public exports, provider, or props.

Expected behavior and authority

Interaction modality INV11 already assigns grouped hover timing to the shared recognizer. The Tooltip contract identifies its missing adoption. The record updates remove that Tooltip gap and link the evidence; HoverCard and menu gaps remain explicit.

The warm window uses the existing exit guard, including the 100 ms default hover bridge. The configured numeric defaults stay the same. Pinned and controlled tooltips retain ownership of their visibility.

Evidence

  • Before: the new trigger-to-trigger test failed because the second onShow had not fired.
  • After: the second hint opens without advancing its entry timer and the first closes once. A Chromium scene checks the same transition, cooldown, keyboard focus and Escape.
  • Regression coverage includes document/group isolation, cancellation, teardown from a callback, and inline-ref reattachment. Existing Tooltip tests protect touch, pinning, controlled state and the hover bridge.

Scope

  • One defect is restored: repeated hover delays between Tooltip triggers.
  • HoverCard/menu adoption and unrelated fixes are left out.
  • No new public API or visual representation; the hover timing change is described above.
  • Public text and artifacts contain no internal Meta context.

Writing rubric results

  • R1: Gap and verification text states current behavior, without implementation history.
  • R2: No research or comparison added to the records.
  • R3: Verification references tests and behavioral outcomes.
  • R4: No rejected alternatives added.
  • R5: No issue or PR references added to the records.
  • R6: No open questions changed. Owner review of the record updates is still required.

Testing

  • pnpm exec vitest run packages/core/src/Tooltip packages/core/src/gestures/__tests__/HoverGestureRecognizer.test.ts --project ui --maxWorkers=1 — 115 passed.
  • pnpm exec playwright test TooltipHoverIntent.a11y.chromium.spec.ts TooltipHoverBridge.a11y.chromium.spec.ts TouchTrigger.a11y.chromium.spec.ts --config playwright.config.ts --project chromium — 24 passed, including existing finger and pen tap cases.
  • pnpm -F @astryxdesign/core typecheck — passed, including the source, test shards and consumer docs.
  • pnpm storybook:build, pnpm check:repo, changed-source ESLint and Prettier checks — passed.
  • pnpm review:pre --base origin/main --head HEAD — no automatic findings; the record changes still require owner approval.

Pen hover handoff is not covered by a dedicated browser case yet. The existing pen tap and held-pen cases pass.

@vercel

vercel Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 9, 2026 7:28pm UTC

Request Review

@meta-cla

meta-cla Bot commented Nov 9, 2026

Copy link
Copy Markdown

Hi @SemihSan!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@astracat-bot

astracat-bot Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟡 Reviewed (for maintainers only) Nov 10, 2026, 2:55 AM UTC

@github-actions github-actions Bot added community Authored by a community contributor (not on the eng/design team) needs:code-review High-risk change (new package/component/API) — needs human code review before merge needs:spec-owner-review Current knowledge records await owner approval labels Nov 9, 2026
vjeux added a commit to vjeux/astryx that referenced this pull request Nov 9, 2026
FR3 in `meta#10858` opens the next trigger in a warm tooltip group at once.
The Behavior row still says a hover opens after `delay`. One sentence
now names the warm-group handoff and points to FR3. Prettier
re-aligns the table.
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec 67dba5f

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 10, 2026

@astracat-bot astracat-bot 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.

Changes requested. The shared hover recognizer and the Tooltip handoff follow the interaction-modality rule and the Tooltip wording approved for this head, and the new handoff tests fail without this change and pass with it. One regression in the detach path needs a fix first.

  • When a trigger unmounts within the leave guard (100 ms, or hideDelay) after the pointer leaves it, the queued clearTimeouts() in useTooltip.tsx now also cancels the pending hide, so the tooltip stays open with no trigger; cancel only the pending show and the group there, let the pending hide finish, and add that case to the detach-and-attach tests.

Two optional notes: the INV11 verification row could name the observable gap instead of "HoverCard and menu adoption", and the full delay entry in useTooltip.doc.mjs could mention the skip as its dense entry does.

[Automated review]

Comment on lines +851 to +855
queueMicrotask(() => {
if (triggerRef.current == null) {
latest().clearTimeouts();
}
});

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.

Blocking. clearTimeouts() is now hover.cancel(), which also clears a pending hide. If the pointer leaves the trigger and the trigger unmounts before the leave guard ends (100 ms, or hideDelay) while the hook stays mounted, the hide never runs: the tooltip stays open with no trigger, and it is already open when the trigger renders again. A row action that renders only while its row is hovered shows this in Chromium; main closes the tooltip. When the trigger stays detached, cancel only the pending show and release the group, and let the pending hide finish. A detach-and-attach test can cover it: hover, wait for the show, leave, remove the trigger, advance 150 ms, expect onHide once.

| INV8 | Owner-defined intent order, pending, close, cancellation, disablement, and unmount mutations | Older work changes current content, selection, status or announcement, visibility, focus, or activation after owner-defined supersession |
| INV9 | Concrete-harm reproduction, representative normal/legacy/no-new-prop paths, and coincident public-delta inventory | Unsupported or aesthetic preference is treated as harm, unaffected behavior changes, or an API, layout, sizing, default, sticky, or exception delta escapes direct authority |
| INV10 | Source boundary check over Core and Lab, a Lab-to-Core comparison on one recorded stream, and release-filter unit tests over recorded iOS pan and scroll-view streams | A Core component with its own sample buffer, velocity math, or release filter; a Lab component with its own sample buffer, velocity math, or release filter; a Lab component reporting a different velocity than Core for the same stream; an export of the tracker; a non-zero release after a still pause |
| INV11 | `HoverGestureRecognizer.test.ts`, Tooltip timing tests and `TooltipHoverIntent.a11y.chromium.spec.ts` cover group handoff, exit guard, document isolation, cancellation and keyboard opening. Evidence gaps: HoverCard and menu adoption, and pen and finger browser coverage of the shared recognizer. | A show without the owner's entry delay, a missed handoff within a group, a delayed keyboard show, a hover-shown surface that closes before the pointer reaches it, a finger served by it, or a second hover-timing implementation fails |

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.

Non-blocking: "HoverCard and menu adoption" states build status. Consider naming the observable gap against INV11 instead, for example: "useHoverCard and useMenuHover keep their own hover timers, so HoverCard and menu triggers do not share the group."

This branch was successfully deployed

1 active deployment
Preview — 67dba5fb Deployed Nov 9, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community Authored by a community contributor (not on the eng/design team) needs:code-review High-risk change (new package/component/API) — needs human code review before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants