Skip to content

fix(Tooltip): a disabled reason is the only tooltip its control shows - #11246

Draft
cixzhang wants to merge 11 commits into
mainfrom
lane4/tooltip-one-per-control
Draft

cixzhang wants to merge 11 commits into
mainfrom
lane4/tooltip-one-per-control

Conversation

@cixzhang

@cixzhang cixzhang commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Primary intent

Fix: a control could show two tooltips at once, its own label tooltip and a component's disabled reason. Now a disabled reason is the only tooltip its control shows. While a reason tooltip covers a control, the control's other tooltip stays closed and adds nothing to its accessible description, so the reason is shown and announced alone.

Owner decision for desktop behavior

This change has two desktop halves (mouse or trackpad hover):

  • Inside the field: hovering a control that shows a disabled reason shows only the reason, not a nested control's label tooltip as well. The owner's recorded answer to the one-tooltip question on feat(ComplexSelector): add disabledMessage #5984 covers this half, and Tooltip FR14 records it. It is not limited to touch input.
  • A Tooltip around a container whose only control is that field: with this change it does not open. This half awaits the owner's decision. The options are: the reason only, the container Tooltip only, or both. This pull request is held until that decision; if the answer is not "the reason only", the code and FR14 change before merge.

User or maintainer impact

  • People using any pointer or the keyboard: hovering, focusing or tapping a disabled control that explains why shows only the reason, not the reason stacked with the control's label tooltip.
  • Screen-reader users: a covered control's accessible description is the reason alone. The label tooltip's text is not read alongside it.
  • Builders: no API change and no caller code. Label-tooltip callers (Button, IconButton, Link, Avatar, <Tooltip>) change nothing. When the reason goes away (the control is enabled), the label tooltip works again. A label tooltip you control with isOpen keeps your value under a reason (no onOpenChange(false)) and shows once the reason ends.

How

  • useTooltip gains a Core-only isReason option through useTooltipInternal, in the same module. The public useTooltip(options) calls it, and TooltipOptions is unchanged.
  • A reason tooltip marks its trigger while it's enabled, using a private attribute whose INV23 owner module is privateAttributes/tooltipReason.stylex.ts (writer plus reader).
  • Every other tooltip checks whether its trigger is the marked control, inside it, or the field's own wrapper (a Tooltip around just that field). If so, it renders no layer element, so its description id resolves to nothing, and an uncontrolled open one closes. A Tooltip around a larger region that also holds another control is not covered. An InfoTip's trigger (a field's labelTooltip help) and the trigger of the field's own status message count as part of the field, so a Tooltip around a field with labelTooltip, or a ComplexSelector with a tooltip status, is still its wrapper. Known limit: a region whose only other control is an unrelated InfoTip counts as the field's wrapper.
  • Never covered: a field's own status message (statusVariant="tooltip", through the Core-only isStatus option, since the field must show its status), and a tooltip whose trigger is its own control (InfoTip through hasOwnControl, and any tooltip held open through show()).
  • When the check runs: when the tooltip would show (in its event path), and when a reason mark changes. setTooltipReason, in the mark's owner module, tells each tooltip whose trigger has attached; each one updates its own covered state, and an open uncontrolled one closes. The list of tooltips is shared across copies of Core. No Effect polls coverage after a render (one layout Effect writes a reason's mark as its enabled state changes, which is what tells the tooltips), there's no document listener and no new public API, and a child that doesn't re-render (a memoized one) follows too.
  • The status icon (useInputStatusIcon) and Selector's and MultiSelector's own status tooltips pass isStatus: true, and InfoTip passes hasOwnControl: true.
  • The 24 components that show a disabled reason (Selector, MultiSelector, ComplexSelector, TextInput, TextArea, NumberInput, Slider, Switch, CheckboxInput, CheckboxList, RadioList, SegmentedControl, Typeahead, Tokenizer, FileInput, the date and time inputs, PowerSearch) pass isReason: true.

Authority

  • Review outcomes: the owner decided the one-tooltip guardrail as "a control never shows two tooltips", with no pointer qualifier, on the tooltip itself (her recorded answer, B and C, to the one-tooltip question raised on feat(ComplexSelector): add disabledMessage #5984). It covers mouse and trackpad as well as touch and keyboard, for a tooltip on the control, inside it, or on its field's own wrapper. A region tooltip, a field's status and a tooltip with its own control stay outside it. component:ComplexSelector DEC-2 places the one-tooltip guardrail in Tooltip, for a caller-rendered trigger, and this change is that guardrail.

  • The owner's decision: design the one-tooltip guardrail in the shared tooltip hook rather than in every tooltip caller.

  • component:Tooltip FR14 (new) states the rule and when it's decided. An Internal modules table names the isReason option and the owner module, each with why existing code isn't enough.

  • architecture:public-component-api INV23: the private attribute has one owner module.

Evidence

  • Red-first (tooltipReason.test.tsx, 6 cases): Button, IconButton, Link, Avatar and a Tooltip-wrapped control, each under a reason; plus a Tooltip around a TextInput disabled with a reason. Each asserts:

    • only the reason shows on hover;
    • the label's text is not in the control's accessible description;
    • when the reason turns off, the label shows and the reason doesn't.

    All 6 fail on main and pass with this change.

  • Sixth round: a field's own status trigger is recorded like an InfoTip's, so a Tooltip around a ComplexSelector with a tooltip status shows only the reason (red-first). The trigger's attach reads its coverage values through a committed ref, not a ref written during render. FR14's wording is corrected.

  • Fifth round: Selector's and MultiSelector's status tooltips stay open under a reason; a Tooltip around a field with labelTooltip shows only the reason (red-first); the setHeld dependency lint fix.

  • Fourth round: coverage moved out of an every-render Effect into the show path plus the owner module's change notices. Red-first: a memoized child drops its label description when a reason turns on later (fails at da0246f, passes). An open label tooltip closes when a reason turns on and returns when it turns off, now without an Effect.

  • Third round: a field's status message under its disabled reason stays in the input's description (TextInput FR9, TextArea FR8). A Switch's help InfoTip opens on a press under the Switch's reason (InfoTip FR2). A Tooltip around a region with a disabled field and another control opens on that control.

  • Second round: a Tooltip around a ComplexSelector disabled with a reason shows only the reason, and a controlled isOpen label tooltip under a reason keeps its value and shows once the reason ends. Both fail at the first head and pass. CheckboxList's pending-changeAction test, which the first head's every-render state update hung, passes.

  • Consumer suites (one worker):

    • Tooltip, Button, IconButton, Link, Avatar, InfoTip and Layer: 76 files, 1,633 tests.
    • Selector, MultiSelector, Typeahead, Tokenizer and PowerSearch: 52 files, 1,764 tests.
    • The date and time inputs: 34 files, 1,306 tests.
    • SegmentedControl, Switch, NumberInput, FileInput and RadioList: 21 files, 856 tests.

    All pass. The remaining five (CheckboxInput, CheckboxList, TextInput, Slider, TextArea) run in CI's full suite.

Size

  • Lines: +836 / −95, about 480 of them tests.
  • App-level gzip: Button and IconButton 59.0 → 59.2 KB, Link 50.9 → 51.1 KB, Table 126.0 → 126.3 KB (+0.2 KB each, from the shared hook). Text and Heading are unchanged.

Scope

  • This PR has one primary intent.
  • Independently removable deltas were removed or split.
  • Public text and artifacts contain no internal Meta context.

Writing rubric results

Run over component:Tooltip FR14, its verification row and the Internal modules table:

  • R1 narration: none; FR14 states the rule in the present tense.
  • R2 research: none. R3 evidence: tests, not pull requests. R4: none. R5: none. R6: none. R7: none.

Owner: fix-loop lane 4. Land path: Held for the owner's answer on the container-Tooltip case; then CodeBunny, CI, and the drain merges.

While a reason tooltip covers a control, every other tooltip on that
control, inside it, or wrapping it renders no text: it neither shows nor
adds to the control's accessible description. useTooltip gains the
Core-only isReason option (useTooltipInternal; the public TooltipOptions
is unchanged), the reason's trigger carries a private mark from its
INV23 owner module, and the 23 disabled-reason components opt in.
Label-tooltip callers change nothing. Tooltip FR14 records the rule.
@vercel

vercel Bot commented Nov 11, 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 13, 2026 4:27am UTC

Request Review

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

astracat-bot Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟡 Reviewed (for maintainers only) Nov 13, 2026, 5:00 AM UTC

@github-actions github-actions Bot added the needs:design-review Affects visuals — Design should review label Nov 11, 2026
@cixzhang cixzhang added ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) ci:run-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) labels Nov 11, 2026
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 11, 2026
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec e2b1029

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

github-actions Bot commented Nov 11, 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
Contributor

Choose a reason for hiding this comment

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

Not ready to approve yet: this needs an owner decision on the desktop behavior change, plus five fixes.

Needs an owner decision

  • For mouse and trackpad users, hovering no longer shows any tooltip on, inside, or around a control that shows a disabled reason, including a <Tooltip> around a whole region that merely contains such a field, and that desktop behavior change needs an owner decision (or gating to touch input).

Required changes

  • The new Effect in useTooltip.tsx (lines 928-935) calls setIsCovered after every render, so a CheckboxList with a pending changeAction re-renders without end: the existing test "shows a spinner only on the toggled item while changeAction is pending" hangs on this branch and passes on main; set state only when coverage changes.
  • ComplexSelector gained disabledMessage on main after this branch forked and still uses plain useTooltip, so after merging, a <Tooltip> around a disabled ComplexSelector or a caller-rendered trigger with its own tooltip still shows two tooltips; rebase and pass isReason: true there.
  • Coverage is read only after the covered tooltip itself re-renders, so a reused child element (hoisted, useMemo, React.memo or the React Compiler) keeps its label in the control's accessible description when a reason turns on; notify covered tooltips when the mark changes and add a stable-child test.
  • A controlled isOpen tooltip under a reason is closed by hideLayer() from an Effect, which reports onOpenChange(false), and it stays hidden after the reason ends while isOpen is still true.
  • The title, changeset and FR14's first sentence say "a control never shows two tooltips", but a <Tooltip> around a Button with its own tooltip still shows two; reword them to what the change does, for example "a disabled reason is the only tooltip its control shows".

The new tests fail on main and pass here for the cases they cover, so please add the missed cases above as tests too.

Automated review (maintainer link)

…with coverage

A covered tooltip renders no layer element, so its description id
resolves to nothing. Coverage state changes only when coverage changes,
which ends the re-render loop CheckboxList's pending changeAction hit.
A controlled isOpen label keeps the caller's value under a reason and
shows once the reason ends. ComplexSelector's disabled reason opts in.
FR14 now reads "a disabled reason is the only tooltip its control
shows" and states the memoized-child limit, with a pending test.
@cixzhang cixzhang changed the title fix(Tooltip): a control never shows two tooltips fix(Tooltip): a disabled reason is the only tooltip its control shows Nov 11, 2026
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 11, 2026
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 8b03e26

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 11, 2026
@cixzhang
cixzhang marked this pull request as ready for review November 11, 2026 17:23

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

Not ready to approve yet: three fixes are needed, and the desktop behavior change still needs an owner decision.

Needs an owner decision

  • For mouse and trackpad users, hover no longer shows any other tooltip on, inside or around a control that shows a disabled reason, including a <Tooltip> around a whole region that merely contains such a field, which stays closed even while the pointer is on another control in that region; that desktop change needs an owner decision, or gating to touch input.

Required changes

  • Miss: a TextInput, TextArea or NumberInput with statusVariant="tooltip" and a status message loses that status while it is disabled with a reason, because isCoveredByTooltipReason (privateAttributes/tooltipReason.stylex.ts:28-32) also covers the status button inside the field, so its tooltip never opens and the input's aria-describedby points at an id that is no longer in the page, against TextInput FR9 and TextArea FR8; let the field's own status tooltip opt out of coverage and add a statusVariant="tooltip" case to tooltipReason.test.tsx.
  • The typecheck job fails because tooltipReason.test.tsx:257 passes onOpenChange to useTooltip, which has no such option, so the spy is never wired and the assertion at line 277 cannot fail; pass onHide and assert it is not called.
  • The lint job fails on three errors this change adds (set-state-in-effect at useTooltip.tsx:359, exhaustive-deps at useTooltip.tsx:932, and no-nested-component-definitions at tooltipReason.test.tsx:256); move ControlledLabel to module scope and fix or justify the other two with a reasoned disable comment.

The CheckboxList hang, the ComplexSelector opt-in, the controlled isOpen behavior and the wording from the last review are fixed, and the new tests fail on main and pass here. A smaller comment suggestion is inline.

Automated review (maintainer link)

@cixzhang
cixzhang marked this pull request as draft November 11, 2026 17:49
@cixzhang
cixzhang marked this pull request as ready for review November 12, 2026 12:56
@cixzhang
cixzhang marked this pull request as draft November 12, 2026 13:09
…oltip-one-per-control

# Conflicts:
#	docs/specs/components/Tooltip/Tooltip.spec.md
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 12, 2026
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec aa1be68

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 12, 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.

Not ready to approve yet: the desktop behavior change still needs an owner decision, and three fixes are needed whatever that decision is.

Needs an owner decision

  • For mouse and trackpad users, while a field shows a disabled reason, hovering a Button, IconButton, Link or Avatar with its own tooltip inside that field, or a <Tooltip> around just that field, now shows only the reason, and a <Tooltip> around a container whose only control is that field no longer opens at all, even on its heading (useTooltip.tsx, privateAttributes/tooltipReason.stylex.ts); approval waits on an owner decision that covers this desktop change, or on gating that part to touch input.

Fixes needed

  • A <Tooltip> around a ComplexSelector with statusVariant="tooltip" still opens beside the disabled reason, because the status button sits outside the marked trigger and makes the wrapper count as a region (tooltipReason.stylex.ts:91-99); recording status-tooltip triggers the way InfoTip triggers are recorded, with a test for this case, would fix it.
  • Newly live check: isReason, syncCoverage and hasOwnControl are added to handlersRef.current, a latest-value ref written during render (useTooltip.tsx:811-813), which architecture:react-component-runtime INV17 and DEC-3 forbid, so they should go through useCommittedRef or useCommittedRefInto, which this branch already has.
  • FR14 and the description say "No Effect reads coverage", but the mount-only isDefaultOpen Effect reads it through showLayer (useTooltip.tsx:992-997), so that sentence needs rewording, for example to "No Effect polls coverage after a render".

CI's accessibility browser-spec leg 1/3 stopped at its 15-minute limit after every spec it ran had passed, so it needs a rerun; the new tests, lint and typecheck pass.

Claims and files checked

Claims:

  • A disabled reason is the only tooltip on its control, inside it, or on a Tooltip around just that field: verified by code and the new tests, except a wrapped ComplexSelector with a tooltip status (fix above).
  • Screen readers hear the reason without the label: verified; a covered tooltip renders no layer, so its description id resolves to nothing.
  • No API change and TooltipOptions unchanged: verified; no package entry reaches useTooltipInternal or its options, and CI's API delta lists no row.
  • A label tooltip held open with isOpen keeps the caller's value and shows once the reason ends: verified by code and its test.
  • The mark is a private attribute with one owner module: verified.
  • A Tooltip around a region with another control still opens, an InfoTip does not count as another control, and the known limit holds: verified by code and tests.
  • A field's status message and a tooltip with its own control are never covered: verified for the status icon hook, Selector, MultiSelector, InfoTip and a show() hold.
  • Coverage is decided on show and on mark changes through a list shared across copies, and a memoized child follows: verified (it is also decided on attach and when a hold changes).
  • No Effect reads coverage: false (fix above).
  • The 24 components that show a disabled reason pass isReason: verified (24 sites, every Core disabled-reason tooltip).
  • The owner decided the one-tooltip rule for every pointer: not verified (owner decision above).
  • The new tests pass: verified in CI; that they fail on main was not rerun.
  • The consumer suites pass: CI's unit suites pass at this head.
  • +805 / -95 lines: verified; about 460 of them tests: approximately (the test file is 436 lines).
  • Bundle size changes: not measured.
  • The changeset's scope (status and help stay available, region tooltips still open, isOpen kept): verified, except the ComplexSelector case above.

Files:

  • .changeset/tooltip-one-per-control.md: accurate except the ComplexSelector case.
  • docs/specs/components/Tooltip/Tooltip.spec.md: FR14's "No Effect reads coverage" (fix above).
  • packages/core/src/Tooltip/useTooltip.tsx: render-time ref write and the Effect sentence (fixes above).
  • packages/core/src/privateAttributes/tooltipReason.stylex.ts: the ComplexSelector status case (fix above).
  • packages/core/src/ComplexSelector/ComplexSelector.tsx: its status button sits beside the marked trigger (fix above).
  • packages/core/src/Tooltip/tooltipReason.test.tsx: clear; no case for the ComplexSelector status wrapper.
  • packages/core/src/hooks/useInputStatusIcon.tsx, Selector/Selector.tsx, MultiSelector/MultiSelector.tsx, InfoTip/InfoTip.tsx: clear.
  • The other 21 reason sites (CheckboxInput, CheckboxList, DateInput, NativeDateField, TouchDateField, DateRangeInput, DateTimeInput, TouchDateTimeField, FileInput, NumberInput, PowerSearch, RadioList, SegmentedControl, Slider, Switch, TextArea, TextInput, TimeInput, TouchTimeField, Tokenizer, Typeahead): clear.

Automated review (maintainer link)

@cixzhang
cixzhang marked this pull request as ready for review November 12, 2026 15:57
… reads a committed ref

The owner module records the trigger of a field's own status tooltip, as
it does an InfoTip's, so a Tooltip around a ComplexSelector with a tooltip
status is still that field's wrapper and shows only the reason (red-first).
The trigger's attach reads isReason, isStatus, hasOwnControl and
syncCoverage through a committed ref instead of a ref written during
render. FR14 says no Effect polls coverage after a render.
@cixzhang
cixzhang marked this pull request as draft November 12, 2026 22:24
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 12, 2026
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 56c4227

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 12, 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.

Not ready to approve yet: the desktop behavior change still needs an owner decision; the fixes requested earlier are in place and nothing else blocks.

Needs an owner decision

  • For mouse and trackpad users, while a field shows a disabled reason, hovering a Button, IconButton, Link or Avatar with its own tooltip inside that field, or a <Tooltip> around just that field, now shows only the reason, and a <Tooltip> around a container whose only control is that field no longer opens at all, even on its heading (useTooltip.tsx, privateAttributes/tooltipReason.stylex.ts); approval waits on an owner decision that covers this desktop change, or on gating that part to touch input.

One new non-blocking note is inline: a covered tooltip leaves its id in the trigger's aria-describedby with no element behind it. CI's first accessibility run stopped at its 15-minute limit in one browser leg after 160 passing tests; CI is running again on this head.

Claims and files checked

Claims:

  • A disabled reason is the only tooltip on its control, inside it, or on a Tooltip around just that field: verified by the new tests, which fail on main, and in Chromium for a wrapped TextInput and a ComplexSelector custom trigger.
  • Screen readers hear the reason without the label: verified; Chromium resolves the control's description to the reason alone (a dangling id remains, noted inline).
  • The desktop change follows the owner's recorded answer on an earlier pull request: not verified; no words or time of that answer are on record.
  • No API change and TooltipOptions unchanged: verified; the API generator lists no row, and useTooltipInternal reaches no package entry.
  • When the reason ends, the label tooltip works again: verified by tests.
  • A label held open with isOpen keeps the caller's value without a close report and shows once the reason ends: verified by code and test.
  • The reason marks its trigger through a private attribute with one owner module: verified; strict lint passes.
  • Other tooltips on, inside or wrapping just the field render no layer, and an open uncontrolled one closes: verified.
  • A Tooltip around a region with another control still opens: verified by test and in Chromium.
  • InfoTip and the field's own status triggers count as part of the field: verified by tests; the record's known limit names only an unrelated InfoTip (earlier inline note).
  • Status tooltips, InfoTip and show() holds are never covered: verified.
  • Coverage is decided on show and on mark changes through a list shared across copies of Core, no Effect polls it, and a memoized child follows: verified (it is also decided when a trigger attaches and when a hold changes).
  • The status icon, Selector and MultiSelector status tooltips pass isStatus, and InfoTip passes hasOwnControl: verified.
  • The 24 disabled-reason sites pass isReason: verified; that is every Core disabled-reason tooltip.
  • ComplexSelector's record places the guardrail in Tooltip: verified for its custom-trigger case; the wrapper and container cases go beyond it.
  • The listed red-first cases fail on main and pass here: verified; 12 of the 15 new tests fail on main and 3 are guards.
  • The earlier-round fixes (Selector and MultiSelector status, labelTooltip wrapper, setHeld dependency, ComplexSelector status wrapper, committed-ref read, FR14 wording): verified.
  • The consumer suites pass, including the five left to CI: verified (141 files, 5,206 tests).
  • +836 / -95 lines, about 480 of them tests: verified; the test file is 459 lines.
  • Bundle size changes: not verified; no size report exists for this head yet.
  • The changeset (reason shown alone, status and help stay available, region tooltips still open, isOpen kept, no API change): verified.

Files:

  • .changeset/tooltip-one-per-control.md: clear.
  • docs/specs/components/Tooltip/Tooltip.spec.md: FR14's known limit omits status triggers (non-blocking, earlier inline note).
  • packages/core/src/Tooltip/useTooltip.tsx: a covered tooltip's dangling describedby id (non-blocking, inline) and two stale comments (non-blocking, earlier threads).
  • packages/core/src/privateAttributes/tooltipReason.stylex.ts: clear.
  • packages/core/src/Tooltip/tooltipReason.test.tsx: clear.
  • packages/core/src/InfoTip/InfoTip.tsx, hooks/useInputStatusIcon.tsx, Selector/Selector.tsx, MultiSelector/MultiSelector.tsx: clear.
  • The other 22 reason-site files (CheckboxInput, CheckboxList, ComplexSelector, DateInput, NativeDateField, TouchDateField, DateRangeInput, DateTimeInput, TouchDateTimeField, FileInput, NumberInput, PowerSearch, RadioList, SegmentedControl, Slider, Switch, TextArea, TextInput, TimeInput, TouchTimeField, Tokenizer, Typeahead): clear; inline-arrow refs re-mark the trigger on each render (non-blocking, earlier thread).

Automated review (maintainer link)

| FR11 | A press inside an open Tooltip surface acts only within that surface: it never activates the trigger, a clickable container around it, or the control a label names. A tooltip that renders inside a FileInput dropzone, a ClickableCard, an Item row, or a `<label>` keeps a click on its text from opening the file picker, activating the container, or toggling or focusing the labelled control. The press still reaches page-level listeners, so a menu or Typeahead inside the surface keeps working. `architecture:layer-runtime` INV17 states this stop for every layer root. | `component:InfoTip` FR2 (a pinning press stops at its button); `component:Tooltip` DEC-1 (one tap does one thing); `architecture:layer-runtime` INV17 |
| FR12 | `useTooltip`'s return includes imperative `show(): void` and `hide(): void`. `show()` opens the tooltip and keeps it open until `hide()`, Escape, a press outside, or focus leaving its trigger, as a pinned tooltip does (FR6, FR9). A `show()` hold that begins during a press on the trigger ends when that press ends off the trigger without a click; the hover rules then decide whether the tooltip stays. `hide()` closes it. Both report through the hook's `onShow` and `onHide`, which the Tooltip component maps to `onOpenChange` (FR8). While `isEnabled` is false, `show()` does nothing. Under a controlled `isOpen`, they report the request through `onShow`/`onHide` and do not override `isOpen` (FR7). They are how an app builds a toggle-style trigger: the app's own button calls them, carries `aria-expanded` (true while shown) and `aria-controls` naming the surface, and keeps its own accessible name. | Owner decision, 2026-11-02: app control through `useTooltip`'s imperative show and hide, not a prop. |
| FR13 | Keys typed into a text-entry field after a finger or pen pressed the trigger are text entry, not keyboard input: character keys, Backspace, Delete, Enter (an on-screen keyboard's Go key), Shift, CapsLock, Dead, Process, Unidentified, and any key during composition leave a pointer press the last input, so focus a closing dialog then returns opens no tooltip (FR4); Tab, Escape, arrow keys, and other named keys are keyboard input. Implementation gap: a field in another document, such as an iframe or a Picture-in-Picture window, is not read as a text-entry field, so typing there still opens the tooltip on the focus a closing dialog returns (Current-state impact). | Current source and tests |
| FR14 | A disabled reason is the only tooltip its control shows, for every pointer and for the keyboard. While a reason tooltip (a component's disabled reason, through `useTooltip`'s Core-only `isReason` option) covers a control, every other tooltip on that control, inside it, or on the field's own wrapper renders no layer: it neither shows nor adds to the control's accessible description, and the reason is announced alone. A tooltip around a larger region that holds the field and other controls is not covered; a tooltip whose trigger is its own control (an InfoTip), or the field's own status message, does not count as another control when deciding whether a Tooltip wraps a field. Known limit: a region whose only other control is an unrelated InfoTip counts as the field's wrapper. A field's own status (`statusVariant="tooltip"`, through the Core-only `isStatus` option) is not covered, and a tooltip whose trigger is its own control (InfoTip, a `show()`-pinned trigger, through the Core-only `hasOwnControl` option or a hold) is never covered. An uncontrolled open tooltip that a reason comes to cover closes; a controlled one keeps the caller's `isOpen` and renders again when the reason ends. Coverage is decided when a tooltip would show and when a reason mark changes: the mark's owner module tells each tooltip that reads it, so a child that does not re-render follows too. No Effect polls coverage after a render (one layout Effect writes a reason's mark as its enabled state changes), nothing watches the page, and no caller code is involved. | Owner decision (one tooltip per control) |

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: the known limit names only "an unrelated InfoTip", but isCoveredByTooltipReason skips every recorded status trigger as well (tooltipReason.stylex.ts:95-98), and a field's status button stays focusable while its field is disabled (useInputStatusIcon.tsx:217-228). So a <Tooltip> around a field disabled with a reason plus a second disabled field with a tooltip status never opens, even on the second field. Suggested: "Known limit: a region whose only other controls are an unrelated InfoTip or another field's status button counts as the field's wrapper."

@cixzhang
cixzhang marked this pull request as draft November 13, 2026 04:17
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec dcd3924

@cixzhang

Copy link
Copy Markdown
Contributor Author

Decision: D-20261113-094

Records the owner's words covering the inner-control case at dcd3924: the disabled reason replaces a control's own tooltip while disabled ("Wire it for render trigger"). The container case, where a caller's Tooltip wraps a disabled field that has a reason, is not yet decided; an owner decision is pending, and this pull request waits for it.

@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 part of this change that keeps a <Tooltip> around a disabled field closed needs an owner decision for desktop, and the description says it already has one.

  • Desktop behavior change needs an owner decision: for mouse and trackpad users, a <Tooltip> around a field disabled with a reason, or around a container whose only control is that field, no longer opens at all, even on the container's own heading (packages/core/src/privateAttributes/tooltipReason.stylex.ts lines 88-103); gate that branch to touch input, or cite the owner decision that covers it.
  • The description's "Owner decision for desktop behavior" and "Authority" sections say the recorded owner answer covers that wrapper and container case, but that case has not been decided yet; limit those sentences to the inner-control case, or cite the decision once it is made.

The inner-control part (a label tooltip on or inside the disabled control) has its owner decision and its tests, and nothing else blocks. Three non-blocking notes are in the existing inline threads: the covered tooltip's id left in aria-describedby, inline-arrow refs that re-mark the trigger on every render, and two stale comments. CI has not run on this head while it is a draft.

Claims and files checked

Claims:

  • A disabled reason is the only tooltip its control shows, and a covered tooltip adds nothing to the control's description: verified by the new tests (12 fail on main, all 15 pass here) and in Chromium.
  • The desktop change, including the wrapper and container case, follows a recorded owner answer: false; the owner's latest comment says the wrapper and container case is still pending.
  • The owner decided "a control never shows two tooltips" for mouse and trackpad, including the field's own wrapper: false for the wrapper; true for the inner-control case.
  • Any pointer or the keyboard shows only the reason: verified; the coverage check has no pointer gate.
  • Screen readers hear the reason alone: verified; the covered tooltip's id stays in aria-describedby with no element (non-blocking).
  • No API change; TooltipOptions unchanged; label-tooltip callers change nothing: verified; the API generator lists no row.
  • When the reason goes away the label tooltip works again, and an isOpen label keeps the caller's value without a close report: verified by tests.
  • The reason marks its trigger through a private attribute with one owner module: verified; strict lint passes.
  • Other tooltips on, inside or wrapping just the field render no layer, an open uncontrolled one closes, and a region with another control is not covered: verified by code, tests and Chromium.
  • InfoTip and the field's own status triggers count as part of the field, with the stated known limit: verified.
  • Status tooltips, InfoTip and show() holds are never covered: verified.
  • Coverage is decided on show and on mark changes through a list shared across copies of Core, with one layout Effect, no document listener, and a memoized child that follows: verified (it is also decided when a trigger attaches and when a hold changes).
  • The status icon, Selector and MultiSelector status tooltips pass isStatus, and InfoTip passes hasOwnControl: verified.
  • The 24 disabled-reason sites pass isReason: verified; no other disabled-reason tooltip remains in Core.
  • ComplexSelector's record places the guardrail in Tooltip for a caller-rendered trigger: verified.
  • The red-first cases fail on main and pass here: verified.
  • The earlier-round fixes (status tooltips, labelTooltip and ComplexSelector status wrappers, setHeld dependency, committed-ref read, FR14 wording, CheckboxList pending action): verified.
  • The consumer suites pass: verified; every listed suite passes here, and Core's typecheck passes.
  • +836 / −95 lines, about 480 of them tests: verified.
  • App-level gzip sizes: not verified; no size report exists for this head.
  • The changeset: verified; it does not mention the container case, which is narrower than the change.

Files:

  • .changeset/tooltip-one-per-control.md: clear.
  • docs/specs/components/Tooltip/Tooltip.spec.md: clear (owner-approved at this head).
  • packages/core/src/privateAttributes/tooltipReason.stylex.ts: the wrapper and container branch needs the owner decision (blocking).
  • packages/core/src/Tooltip/useTooltip.tsx: dangling description id and two stale comments (non-blocking).
  • packages/core/src/Tooltip/tooltipReason.test.tsx: clear.
  • packages/core/src/InfoTip/InfoTip.tsx, packages/core/src/hooks/useInputStatusIcon.tsx, packages/core/src/Selector/Selector.tsx, packages/core/src/MultiSelector/MultiSelector.tsx: clear.
  • packages/core/src/TextInput/TextInput.tsx and the other reason sites with inline-arrow refs: clear; the re-marking on each render is non-blocking.
  • CheckboxInput, CheckboxList, ComplexSelector, DateInput, NativeDateField, TouchDateField, DateRangeInput, DateTimeInput, TouchDateTimeField, FileInput, NumberInput, PowerSearch, RadioList, SegmentedControl, Slider, Switch, TextArea, TimeInput, TouchTimeField, Tokenizer, Typeahead: clear.

Automated review (maintainer link)

Comment on lines +88 to +103
const marks = element.querySelectorAll(SELECTOR);
if (marks.length !== 1) {
return false;
}
const mark = marks[0];
for (const control of element.querySelectorAll(FOCUSABLE_SELECTOR)) {
// A layer the field opens, such as its panel, belongs to the field.
if (
!mark.contains(control) &&
control.closest('[popover]') == null &&
!fieldTooltipTriggers.has(control)
) {
return false;
}
}
return true;

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.

Desktop behavior change needs an owner decision: this wrapper branch makes a <Tooltip> around a field disabled with a reason, or around a container whose only control is that field, never open for mouse and trackpad users, even on the container's own heading (on main it opens). Gate this branch to touch input, or cite the owner decision that covers it; dropping the wrapper case, with its FR14 clause and tests, also clears it.

props?: Omit<ContextRenderProps, 'positioning'>,
): ReactNode => {
if (isCovered) {
return null;

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: a covered tooltip renders nothing here, but its id stays in the trigger's aria-describedby. In Chromium a wrapping card's aria-describedby names an id no element has, and a ComplexSelector renderTrigger Button keeps the reason plus that id. Assistive technology skips the missing id, so the reason is still announced alone, but conformance checkers report a reference to a missing element. Rendering an empty element under the same id while covered keeps the description empty with no dangling reference.

This branch was successfully deployed

1 active deployment
Preview — dcd39242 Deployed Nov 13, 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 A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) 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