Skip to content

feat(core): InfoTip moves to Core as the info preset over Tooltip's press toggle - #9238

Draft
vjeux wants to merge 2 commits into
meta:mainfrom
vjeux:infotip-core
Draft

vjeux wants to merge 2 commits into
meta:mainfrom
vjeux:infotip-core

Conversation

@vjeux

@vjeux vjeux commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Stacks on #9232 (pressTrigger): only the last commit is this pull request's own.

User need

Touch, keyboard, and screen-reader users can open the help behind an "i" but not keep it open to read it. Lab's InfoTip pins nothing, and its button is named by an untranslated "More information".

Problem and solution fit

This is part of making Astryx's touch components behave like native iOS ones. #9175 decided that InfoTip is Tooltip with pressTrigger="toggle" on a named button (DEC-1).

Current specification

component:InfoTip (#9175) and component:Tooltip FR9–FR10. Its record edits close the gaps and need the owner's approval.

Public delta and caller burden

  • Core export InfoTip: content, label, size, a ref to the button, xstyle, className, and style.
  • Hover and focus preview the help. A click, tap, Enter, or Space pins it until Escape, a second press, a press outside, or focus leaving.
  • Its name comes from the catalog. Under a coarse pointer it takes taps out toward 44 px, stopping halfway to a neighbour.
  • Lab's InfoTip becomes a deprecated re-export for one release, and the ShadCN registry keeps its Lab route as an alias.

Design and alternatives

Evidence

  • Unit: a click, Enter, Space, or tap pins the help (aria-expanded, aria-controls), and pointer leave keeps it. The ref and style props reach the button, and the name comes from the catalog.
  • Chromium, coarse pointer: taps within 22 px of the center reach the button and farther ones don't. Between neighbours each half belongs to the nearer one, and a fine pointer grows nothing.

Scope

  • One capability is added.
  • Unrelated fixes, cleanup, and policy changes were removed or split.
  • Consumer docs, focused tests, and migration evidence ship with the feature.
  • Public text and artifacts contain no internal Meta context.

Writing rubric results

InfoTip.spec.md: R1, R2, R4, R5, R6: none. R3: each verification cell names its test.

Testing

  1. In Storybook's Core/InfoTip › Touch, with touch emulation, a tap on the "i" pins the help, and a tap outside closes it.
  2. Tab to it and press Enter: it pins.
  3. Local gates at 0812a94: build, typecheck, lint, Prettier, repo checks, docsite route check, Storybook, pnpm test:ui, and the browser test (also 2-core pinned) pass; the node project fails only fix(cli): a crashed run's release install is recognized by the Node it ran on, whatever its name #8520's cache cases. The press, ref, catalog, and hit-area cases fail without their change.

@vercel

vercel Bot commented Nov 1, 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 1, 2026 2:40am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 1, 2026
@astracat-bot

astracat-bot Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

AI review status for this pull request.

Review status Updated
❓ Needs maintainer input (for maintainers only) Nov 1, 2026, 2:59 AM UTC

@github-actions github-actions Bot added the needs:design-review Affects visuals — Design should review label Nov 1, 2026
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 1, 2026
@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

Current run: The current CI run concluded skipped. Current analysis is unavailable.


Generated by PR Enrichment workflow | View current CI run

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Requesting changes: the InfoTip promotion follows component:InfoTip, but the stacked pressTrigger work has defects to fix first, and the branch should be split.

  • The docsite build fails: InfoTip's ShadCN route moves from components/lab/info-tip with no alias, so add registry: {aliases: ['lab/info-tip']} to InfoTip.doc.mjs (as Drawer does) and refresh the route lock.
  • Land #9232 first and rebase, so this pull request carries only the InfoTip commit (about 1,600 of its 3,900 authored lines).
  • A labelled HoverCard whose trigger is not a button loses aria-controls/aria-expanded under pressTrigger="toggle" (HoverCard.tsx:380), though FR9 keeps it on tap behavior.
  • The pin announcement and the outside-press dismissal in usePressPin.ts duplicate useAnnounceRenderedText (which leaves out aria-hidden text) and useTouchTrigger's outside dismissal; reuse those owners.
  • DEP-0016 needs its @deprecated metadata on tap, and FieldLabel and the Tooltip story still use touchTrigger="tap".

[Automated review]


// Under the toggle, the press pin owns aria-expanded (true only while
// pinned) and aria-controls (FR10); the popup role stays here.
const ownsToggleState = pressTrigger !== 'toggle';

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This hands aria-expanded and aria-controls to the press pin for every toggle trigger, but usePressPin wires only buttons. A labelled HoverCard on a link or span still opens on tap and now has neither attribute, unlike under touchTrigger="tap" (HoverCard FR3, FR9). Could this follow isPressPinTrigger(firstChild) instead of the prop?

Comment thread packages/core/src/Layer/usePressPin.ts Outdated
const isExpanded = (isOpen !== undefined ? isOpen : isPinned) && isLayerOpen;

// While pinned, a press or focus outside the trigger and the layer closes it.
useEffect(() => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

useTooltip and useHoverCard already call useTouchTrigger, whose armOutsideDismiss owns the press-outside close and arms from the opening handler. This second listener closes on pointerdown where that one closes on lift. Extending that owner and arming it from toggle() would keep one path.

// Said once when the layer pins; a preview says nothing beyond the
// trigger's description.
const announcedRef = useRef(false);
useEffect(() => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The callers feed this raw textContent, so aria-hidden text is read and blocks run together ("Ada Lovelace★Analyst"). spec:AST-086 FR12 and react-component-runtime INV10 route own-content announcements through useAnnounceRenderedText, with no Effect of the adopter's own.

Comment thread packages/core/src/InfoTip/InfoTip.tsx Outdated
const mergedRef = useMergedRefs(ref, buttonRef);

// Under a coarse pointer the button takes taps out toward 44 px (AR1).
useEffect(() => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The watch starts because the button attached. A callback ref merged with ref (React 19 ref cleanup) can start and stop it, and it handles node replacement, so this Effect can go.

| downstream | In the deprecating release, Core FieldLabel's info icon moves from `touchTrigger="tap"` to `component:InfoTip` with `pressTrigger="toggle"` (`component:FieldLabel` FR9), and Lab InfoTip and the CLI page templates migrate too, the templates to a button trigger with `pressTrigger="toggle"` so they carry no development warning (`spec:AST-017` FR29c); docs, stories, templates, and examples teach only `pressTrigger` |
| transition | no prior transition |
| state | `proposed` |
| state | `deprecated` |

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

deprecated here comes before DEP-0016's downstream is done: FieldLabel.tsx:316 still passes touchTrigger="tap", and Tooltip.stories.tsx:373 still teaches it (spec:AST-017 FR29b, FR29c).

…ress

`component:Tooltip` and `component:HoverCard` FR9 and FR10, `spec:AST-003`
FR4:

- `pressTrigger` (`none`, the default, or `toggle`) on Tooltip, HoverCard,
  useTooltip and useHoverCard, with the types TooltipPressTrigger,
  HoverCardPressTrigger and LayerPressTrigger. With `toggle` on a button
  trigger, a click, a tap, Enter, or Space pins the layer and the same press
  closes it; hover and focus still preview it.
- A pinned layer stays until Escape, a second press, a press or scroll
  outside (useTouchTrigger's outside dismissal, which the pin arms), or focus
  leaving the trigger and the layer (each layer's focus-leave path), and
  takes Escape before the layer beneath it.
- The press stops at its trigger. The trigger carries aria-expanded and
  aria-controls on a button trigger (a labelled HoverCard keeps its own on
  any other trigger), and the layer is announced once when it pins, through
  useAnnounce, so inside a modal too.
- A non-button trigger gets a development warning and keeps tap-only
  opening; a trigger whose layer repeats its own text pins without toggle
  state (`Layer/usePressPin.ts`).
…s press toggle

InfoTip moves to Core: a named info-icon button wrapped in Tooltip with pressTrigger="toggle", so hover and keyboard focus preview the help and a click, tap, Enter, or Space pins it open. Its default name comes from the translation catalog, it forwards a ref to the button and takes xstyle, className, and style, and under a coarse pointer it takes taps out toward 44 px through the shared hit area. The Lab export becomes a deprecated re-export of the Core component.
@vjeux

vjeux commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

Fixed in 0812a94: the hit-area watch now starts from a callback ref merged with ref, with no Effect, and the ShadCN registry keeps InfoTip's Lab route as an alias, which fixes the Vercel build. The pressTrigger points belong to #9232, fixed there in c543d57, with DEP-0016 moving to its follow-up. Once #9232 lands, this pull request carries only the InfoTip commit.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The InfoTip promotion follows component:InfoTip, but approval waits on an engineering owner's decision about two new @astryxdesign/core/Layer exports and on a few fixes in the stacked pressTrigger commit.

  • LayerPressTrigger and armOutsideDismiss on useTouchTrigger's return become public API that no current record decides; an engineering owner records whether they stay public by commenting /approve-spec <head SHA> (the author may, if they are one), or they can be kept internal.
  • The pin announcement reads raw textContent in an Effect of its own, so aria-hidden text is spoken and paragraphs run together ("Revenue30-day rolling average."); announce through useAnnounceRenderedText instead (spec:AST-086 FR12).
  • The touchDismissRef Effects in useTooltip and useHoverCard only copy callbacks into a ref; assign the ref during render and drop them.
  • Switching pressTrigger from none to toggle after mount never wires the pin; re-attach when the prop changes and add a rerender test.
  • Land #9232 with these fixes, then rebase so this pull request carries only the InfoTip commit (about 1,600 of its 3,400 authored lines).

[Automated review]

return;
}
announcedRef.current = true;
const text = optionsRef.current.announcement()?.trim();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

announcement() hands this raw textContent, so aria-hidden glyphs are spoken and blocks run together (an InfoTip with two paragraphs is announced "Revenue30-day rolling average."). spec:AST-086 FR12 and react-component-runtime INV10 route own-content announcements through useAnnounceRenderedText, with no Effect of the adopter's own.

Comment on lines +440 to +442
useEffect(() => {
touchDismissRef.current = {arm: armOutsideDismiss, disarm: clearTapOpen};
}, [armOutsideDismiss, clearTapOpen]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This Effect synchronizes no external system (react-component-runtime INV3); it only copies two callbacks into a ref. Assigning touchDismissRef.current during render, as useTouchTrigger does for hideRef, removes it; useHoverCard.tsx:450 has the same one.

}

triggerRef.current = el;
attachPressPin(el);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The pin attaches only when this ref re-attaches, and the dependencies leave out pressTrigger, so a Tooltip rerendered from none to toggle never wires it: no aria-expanded, and a click does nothing. Could attach re-run when pressTrigger changes?

This branch was successfully deployed

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

Labels

CLA Signed This label is managed by the Meta Open Source bot. needs:design-review Affects visuals — Design should review needs:spec-owner-review Current knowledge records await owner approval

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant