Skip to content

fix(Tooltip): a held-closed tooltip reports keyboard focus without opening - #10490

Merged
cixzhang merged 6 commits into
mainfrom
lane4/tooltip-controlled-intent
Nov 8, 2026
Merged

cixzhang merged 6 commits into
mainfrom
lane4/tooltip-controlled-intent

Conversation

@cixzhang

@cixzhang cixzhang commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Builders who control a Tooltip with isOpen can now hold it closed against keyboard focus. Held closed (isOpen={false}), focus that would open the tooltip calls onOpenChange(true) and shows nothing, so the caller decides whether to open it. This mirrors how a held-open tooltip already answers Escape with onOpenChange(false) without hiding.

Before this change, keyboard focus (or a click into a text-field trigger) opened a held-closed tooltip anyway, and Escape then couldn't close it, because Escape only reported onOpenChange(false), which the caller already held. component:Tooltip FR7 recorded that as an implementation gap.

Everything else stays as released: isOpen={true} still suppresses hover and focus hiding, and a held-closed hover still reports nothing. Reporting those two changes released controlled behavior, so it moves to a separate change for the next minor.

What changes

  • useTooltip: with isOpen={false}, the focus path calls onShow (which Tooltip maps to onOpenChange(true)) instead of opening the layer.
  • component:Tooltip FR7: "isOpen forces the tooltip shown or hidden, and isOpen={true} suppresses hover and focus hiding; a controlled tooltip answers Escape by calling onOpenChange(false) without hiding, and is not closed by pressing the trigger. With isOpen={false}, focus FR4 opens on calls onOpenChange(true) and shows nothing." Its implementation gap and the matching Current-state entries are removed, and a verification row covers held-closed focus and held-open Escape.
  • The isOpen and onShow JSDoc, Tooltip.doc.mjs and useTooltip.doc.mjs describe the focus report.
  • Changeset: core patch, [fix].

Tests

  • Red first: on main, the held-closed keyboard-focus case fails, because focus shows the tooltip. It passes here, as does the held-open Escape case.
  • Tooltip suites pass (4 files, 105 tests).

Writing rubric results

  • R1 narration: none; FR7 describes current behavior in the present tense.
  • R2 research in the record: none.
  • R3 evidence naming a change: none.
  • R4 rejected alternatives: none.
  • R5 pull request or issue references: none.
  • R6 scope: FR7's held-closed focus report and its verification row only.

…thout showing

With isOpen={false}, hover reported nothing and focus opened the
tooltip and reported onOpenChange(true), so a caller could not hold it
closed. Now a hover that would open it after the delay, or focus that
would open it, calls onOpenChange(true) once and shows nothing, matching
how a held-open tooltip reports Escape as onOpenChange(false) without
hiding. component:Tooltip FR7 records the symmetric contract, drops its
implementation gap and the matching current-state entry, and gains a
verification row.
@vercel

vercel Bot commented Nov 7, 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 8, 2026 10:25pm UTC

Request Review

@astracat-bot

astracat-bot Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 8, 2026, 10:41 PM UTC

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 7, 2026
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 7, 2026
@cixzhang

cixzhang commented Nov 7, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec 87f9f6c

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

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · ce83682

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
CodeBlock 75.1 kB (+21 B) · 11.3 kB CSS (0) — — · — · —
Tokenizer 91.4 kB (+21 B) · 18.8 kB CSS (0) — — · — · —
Button 60.3 kB (+19 B) · 10.0 kB CSS (0) — — · — · —
108 more components
Component Size LoC Visual · A11y · RTL
Calendar 71.3 kB (+19 B) · 10.6 kB CSS (0) — — · — · —
ChatSendButton 60.7 kB (+19 B) · 10.0 kB CSS (0) — — · — · —
CheckboxList 67.8 kB (+19 B) · 7.7 kB CSS (0) — — · — · —
MultiSelector 94.7 kB (+19 B) · 16.8 kB CSS (0) — — · — · —
lab/SelectableCardGroup 64.4 kB (+19 B) · 162 B CSS (0) — — · — · —
charts/ChartTooltip 180.1 kB (+18 B) · 423 B CSS (0) — — · — · —
DropdownMenu 97.0 kB (+18 B) · 17.6 kB CSS (0) — — · — · —
MoreMenu 97.3 kB (+18 B) · 17.6 kB CSS (0) — — · — · —
SegmentedControl 94.6 kB (+18 B) · 6.9 kB CSS (0) — — · — · —
Stepper 61.9 kB (+18 B) · 10.1 kB CSS (0) — — · — · —
TimeInput 160.3 kB (+18 B) · 16.0 kB CSS (0) — — · — · —
richtext/RichTextEditorToolbar 277.7 kB (+18 B) · 454 B CSS (0) — — · — · —
AlertDialog 105.4 kB (+17 B) · 14.6 kB CSS (0) — — · — · —
ChatDictationButton 60.8 kB (+17 B) · 10.0 kB CSS (0) — — · — · —
DrawerHeader 63.3 kB (+17 B) · 12.9 kB CSS (0) — — · — · —
IconButton 60.3 kB (+17 B) · 10.0 kB CSS (0) — — · — · —
MobileNavToggle 60.6 kB (+17 B) · 10.0 kB CSS (0) — — · — · —
Selector 99.6 kB (+17 B) · 17.4 kB CSS (0) — — · — · —
SideNav 112.6 kB (+17 B) · 11.4 kB CSS (0) — — · — · —
TableSelectionToolbar 70.5 kB (+17 B) · 13.2 kB CSS (0) — — · — · —
TopNavMegaMenu 69.7 kB (+17 B) · 11.8 kB CSS (0) — — · — · —
lab/CommentComposer 149.5 kB (+17 B) · 1.9 kB CSS (0) — — · — · —
lab/DialogHeroHeader 83.2 kB (+17 B) · 372 B CSS (0) — — · — · —
lab/Schedule 105.9 kB (+17 B) · 3.9 kB CSS (0) — — · — · —
Avatar 43.1 kB (+16 B) · 5.5 kB CSS (0) — — · — · —
Banner 62.2 kB (+16 B) · 10.5 kB CSS (0) — — · — · —
DialogHeader 63.1 kB (+16 B) · 11.5 kB CSS (0) — — · — · —
FieldLabel 51.1 kB (+16 B) · 5.7 kB CSS (0) — — · — · —
PowerSearch 285.0 kB (+16 B) · 24.1 kB CSS (0) — — · — · —
Switch 102.3 kB (+16 B) · 9.9 kB CSS (0) — — · — · —
Thumbnail 64.6 kB (+16 B) · 11.6 kB CSS (0) — — · — · —
TopNav 72.2 kB (+16 B) · 10.9 kB CSS (0) — — · — · —
lab/TransferList 108.4 kB (+16 B) · 1.7 kB CSS (0) — — · — · —
ChatComposer 77.9 kB (+15 B) · 12.0 kB CSS (0) — — · — · —
ChatLayoutScrollButton 60.8 kB (+15 B) · 10.2 kB CSS (0) — — · — · —
ComplexSelector 71.0 kB (+15 B) · 11.8 kB CSS (0) — — · — · —
DateInput 184.9 kB (+15 B) · 17.0 kB CSS (0) — — · — · —
DateRangeInput 92.4 kB (+15 B) · 12.5 kB CSS (0) — — · — · —
InfoTip 46.6 kB (+15 B) · 5.3 kB CSS (0) — — · — · —
Link 53.1 kB (+15 B) · 7.0 kB CSS (0) — — · — · —
MobileNav 70.6 kB (+15 B) · 10.6 kB CSS (0) — — · — · —
SideNavCollapseButton 61.1 kB (+15 B) · 10.0 kB CSS (0) — — · — · —
Slider 107.7 kB (+15 B) · 8.8 kB CSS (0) — — · — · —
TableCell 109.5 kB (+15 B) · 17.9 kB CSS (0) — — · — · —
TextArea 62.4 kB (+15 B) · 9.3 kB CSS (0) — — · — · —
Typeahead 79.6 kB (+15 B) · 12.4 kB CSS (0) — — · — · —
lab/DiffViewer 87.0 kB (+15 B) · 2.1 kB CSS (0) — — · — · —
lab/TransferListSelector 115.0 kB (+15 B) · 1.9 kB CSS (0) — — · — · —
BreadcrumbItem 84.6 kB (+14 B) · 12.1 kB CSS (0) — — · — · —
Pagination 109.7 kB (+14 B) · 17.8 kB CSS (0) — — · — · —
TabMenu 71.8 kB (+14 B) · 11.1 kB CSS (0) — — · — · —
lab/Comments 348.3 kB (+14 B) · 2.5 kB CSS (0) — — · — · —
lab/CommentThread 341.6 kB (+14 B) · 2.4 kB CSS (0) — — · — · —
lab/ListInput 102.1 kB (+14 B) · 1.6 kB CSS (0) — — · — · —
Carousel 69.8 kB (+13 B) · 10.9 kB CSS (0) — — · — · —
DateTimeInput 206.6 kB (+13 B) · 18.7 kB CSS (0) — — · — · —
Field 54.9 kB (+13 B) · 7.2 kB CSS (0) — — · — · —
InputGroup 56.6 kB (+13 B) · 7.8 kB CSS (0) — — · — · —
RadioListItem 67.4 kB (+13 B) · 10.1 kB CSS (0) — — · — · —
TableHeaderCell 109.0 kB (+13 B) · 17.7 kB CSS (0) — — · — · —
Toast 98.1 kB (+13 B) · 10.3 kB CSS (0) — — · — · —
TopNavMenu 74.5 kB (+13 B) · 11.2 kB CSS (0) — — · — · —
lab/ChatReactionBar 105.3 kB (+13 B) · 1.1 kB CSS (0) — — · — · —
ChatComposerInput 75.6 kB (+12 B) · 11.3 kB CSS (0) — — · — · —
ChatComposerTokenElement 75.6 kB (+12 B) · 11.3 kB CSS (0) — — · — · —
CheckboxInput 64.2 kB (+12 B) · 9.2 kB CSS (0) — — · — · —
ContextMenu 108.2 kB (+12 B) · 17.4 kB CSS (0) — — · — · —
Markdown 187.2 kB (+12 B) · 20.6 kB CSS (0) — — · — · —
SideNavHeading 75.6 kB (+12 B) · 11.3 kB CSS (0) — — · — · —
SideNavItem 70.5 kB (+12 B) · 11.1 kB CSS (0) — — · — · —
ToggleButton 86.7 kB (+12 B) · 10.1 kB CSS (0) — — · — · —
richtext/RichTextView 276.2 kB (+12 B) · 2.3 kB CSS (0) — — · — · —
AvatarGroup 45.9 kB (+11 B) · 5.7 kB CSS (0) — — · — · —
ChatLayout 81.4 kB (+11 B) · 10.5 kB CSS (0) — — · — · —
NumberInput 71.7 kB (+11 B) · 11.4 kB CSS (0) — — · — · —
StatusDot 31.2 kB (+11 B) · 5.3 kB CSS (0) — — · — · —
Table 124.5 kB (+11 B) · 18.3 kB CSS (0) — — · — · —
TextInput 67.7 kB (+11 B) · 11.2 kB CSS (0) — — · — · —
TopNavHeading 75.2 kB (+11 B) · 11.2 kB CSS (0) — — · — · —
lab/ChatEmojiPicker 104.2 kB (+11 B) · 773 B CSS (0) — — · — · —
lab/EmojiPicker 86.5 kB (+11 B) · 751 B CSS (0) — — · — · —
richtext/RichTextEditor 297.2 kB (+11 B) · 2.6 kB CSS (0) — — · — · —
AvatarGroupOverflow 48.9 kB (+10 B) · 5.6 kB CSS (0) — — · — · —
CheckboxListItem 71.3 kB (+10 B) · 11.4 kB CSS (0) — — · — · —
Lightbox 120.9 kB (+10 B) · 10.6 kB CSS (0) — — · — · —
RadioList 56.3 kB (+10 B) · 7.3 kB CSS (0) — — · — · —
Tooltip · Storybook 29.5 kB (+10 B) · 4.4 kB CSS (0) 870 (+5) ✓ · ✓ · ✓
charts/Chart 202.7 kB (+9 B) · 494 B CSS (0) — — · — · —
AppShell 90.9 kB (+9 B) · 13.5 kB CSS (0) — — · — · —
lab/CommentPin 57.1 kB (+9 B) · 1.2 kB CSS (0) — — · — · —
ListItem 70.3 kB (+8 B) · 11.4 kB CSS (0) — — · — · —
lab/TourStep 95.8 kB (+8 B) · 590 B CSS (0) — — · — · —
BaseTypeahead 71.1 kB (+7 B) · 10.9 kB CSS (0) — — · — · —
FileInput 69.2 kB (+7 B) · 10.9 kB CSS (0) — — · — · —
Popover 89.5 kB (+7 B) · 14.2 kB CSS (0) — — · — · —
DropdownMenuSubMenu 70.2 kB (+2 B) · 9.7 kB CSS (0) — — · — · —
ChatMessageList 27.9 kB (+1 B) · 7.0 kB CSS (0) — — · — · —
CommandPaletteInput 31.5 kB (+1 B) · 7.5 kB CSS (0) — — · — · —
ProgressBar 11.7 kB (0) · 6.3 kB CSS (0) — — · — · —
Spinner 24.6 kB (0) · 6.2 kB CSS (0) — — · — · —
Timer 13.8 kB (0) · 6.0 kB CSS (0) — — · — · —
Timestamp 32.7 kB (0) · 10.3 kB CSS (0) — — · — · —
lab/LineClamp 13.8 kB (0) · 168 B CSS (0) — — · — · —
charts/ChartLegend 49.4 kB (−1 B) · 224 B CSS (0) — — · — · —
ChatToolCalls 31.8 kB (−1 B) · 8.3 kB CSS (0) — — · — · —
CommandPalette 73.1 kB (−1 B) · 12.7 kB CSS (0) — — · — · —
Heading 12.3 kB (−1 B) · 5.4 kB CSS (0) — — · — · —
Text 11.7 kB (−1 B) · 5.4 kB CSS (0) — — · — · —

Package size: @astryxdesign/core 7.17 MB packed (+410 B); no new dependencies.

API changes: none in this pull request

Committed API report behind this build: cli 29 rows, core 34 rows, theme-butter 1 row, theme-y2k 1 row; run pnpm api:report.

Touched components checked; add ci:run-visual or ci:run-rtl to run the full suites.

Accessibility: 1 violation(s)

Accessibility Audit

Status: 1 accessibility violation(s) found — 1 serious.

Tooltip - 1 issue(s)
  • 🟠 serious: Ensure elements that have scrollable content are accessible by keyboard in Safari
    • Rule: scrollable-region-focusable · Affects 1/28 stories · Learn more
    • WCAG: 2.1.1, 2.1.3 (Level A)

Generated by PR Enrichment workflow | View full report

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

Requesting changes. The held-closed report works as described, and the new held-closed tests fail on main and pass here, but two things need fixing first:

  • The Tooltip record still cites the FR7 gap this change removes: ORD1 ("apart from FR7's focus gap"), AR2 and AR5 ("FR7's held-closed Escape gap"), and "Nine implementation gaps" in the readiness row, though Current-state impact now lists eight.
  • A controlled tooltip wired to state (isOpen={open} onOpenChange={setOpen}) now opens on mouse hover and stays open after the pointer leaves, because a held-open tooltip still reports nothing on leave, and Lab CommentActions' "Copy comment link" tooltip now behaves this way; either report that leave as onOpenChange(false) (with FR7 saying so) or change CommentActions, and add a test that such a tooltip closes once the pointer leaves.

Smaller: useTooltip's own isOpen and onShow docs (its JSDoc and useTooltip.doc.mjs) do not mention the held-closed report yet. CI has not run on this head because the pull request is still a draft.

[Automated review]

…p-controlled-intent

# Conflicts:
#	docs/specs/components/Tooltip/Tooltip.spec.md
With held-closed hover reporting onOpenChange(true), a tooltip wired to
state opened on hover but never heard the leave, so it stayed open. A
held-open tooltip now reports a pointer or focus leave as
onOpenChange(false) and hides nothing, as it does for Escape. FR7, the
hook and component docs and the changeset say so, and the record drops
the gap references this change removes (eight gaps remain).

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

Requesting changes. The controlled reporting works as FR7 now describes it and is well tested, but it ships as a patch [fix] while it changes behavior that existing controlled callers rely on.

Blocking

  • With isOpen={true}, a pointer or focus leave now calls onOpenChange(false), the same call Escape makes, so an app that holds a tip open and agrees to its requests (like the Layer Dismissal "Pinned tooltip in modal" story) loses the tip when the pointer crosses the trigger; that replaces the released "hover/focus hide is suppressed" contract, so it needs a [breaking] changeset with a migration in a declared minor, or an opt-in beside the released behavior, instead of a patch [fix] (AST-017 FR1, FR5, FR7, FR31).
  • Miss: the held-closed hover report, already present in the first revision reviewed, changes the same apps (after Escape closes the pinned tip, the next hover reopens it) and needs the same classification.

Also worth a look

  • Tooltip.doc.mjs, the onOpenChange JSDoc and the short useTooltip.doc.mjs descriptions do not mention the new reports, and the held-open focus-leave report has no test.

The held-closed keyboard-focus fix restores FR7 on its own and can ship as a patch. CI has not run on this draft head yet.

[Automated review]

Comment thread .changeset/tooltip-controlled-intent.md Resolved
@cixzhang cixzhang added the ci:run-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) label Nov 8, 2026
@cixzhang
cixzhang marked this pull request as ready for review November 8, 2026 21:55
@cixzhang
cixzhang marked this pull request as draft November 8, 2026 22:16
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 8, 2026
…in a patch

A held-closed tooltip reports keyboard focus as onOpenChange(true) and
shows nothing. The held-open leave report and the held-closed hover
report change released behavior, so they move to a separate change for
the next minor. FR7 keeps 'isOpen={true} suppresses hover and focus
hiding' and adds only the focus report.
@cixzhang cixzhang changed the title fix(Tooltip): a held-closed tooltip reports hover and focus intent without showing fix(Tooltip): a held-closed tooltip reports keyboard focus without opening Nov 8, 2026
@cixzhang

cixzhang commented Nov 8, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec ce83682

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

Approved pending CI: CI has not run on this head yet, because the pull request is still a draft; it runs once the pull request is marked ready for review.

Keyboard focus, or a click into a text-field trigger, no longer opens a Tooltip held at isOpen={false}; it reports that focus as onOpenChange(true) once and shows nothing, as FR7 now states. The new held-closed test fails on main and passes here, and the narrowed change only restores the documented isOpen={false} behavior, so a patch [fix] fits.

Two optional follow-ups:

  • onOpenChange's own JSDoc and doc entries, and the short isOpen and onShow entries in useTooltip.doc.mjs, still say true means shown; one clause about the held-closed request would keep them accurate.
  • A test with an <input> trigger would pin the text-field case the changeset names.

[Automated review]

type: 'boolean',
description: 'Controlled open state for the tooltip.',
description:
'Controlled open state for the tooltip. Held closed, focus that would open it calls onOpenChange(true) and shows nothing; held open, Escape calls onOpenChange(false) and it stays.',

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: this entry now explains the held-closed report, but the onOpenChange entry above (line 121, "Called with true when shown and false when hidden"), its short form at lines 363-364, the onOpenChange JSDoc in Tooltip.tsx:129-130 and the short isOpen and onShow entries in useTooltip.doc.mjs:175-178 still say true means shown. One clause such as "Under isOpen={false}, true also reports focus that would open it" keeps a reader of the callback alone from treating the request as a show.

.closest<HTMLElement>('[popover]')
?.matches(':popover-open') ?? false;

it('reports keyboard-focus intent once while held closed, and shows nothing', async () => {

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: FR7 covers "focus FR4 opens on", and the changeset names a click into a text-field trigger, but this case covers keyboard focus only. The same guard handles the text field (a mouse press plus focus on an <input> trigger held closed shows nothing at this head and opens on main); a second case with an <input> trigger would pin it.

@cixzhang
cixzhang marked this pull request as ready for review November 8, 2026 23:21
@cixzhang
cixzhang merged commit 48c480b into main Nov 8, 2026
130 checks passed
@github-actions
github-actions Bot deleted the lane4/tooltip-controlled-intent branch November 9, 2026 06:03

This branch was successfully deployed

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

Labels

ci:run-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant