Skip to content

fix(core): a tap's compatibility mouse events do not open HoverCard or Tooltip - #12605

Draft
cixzhang wants to merge 22 commits into
mainfrom
fix/hover-ignores-touch-compat-mouse
Draft

cixzhang wants to merge 22 commits into
mainfrom
fix/hover-ignores-touch-compat-mouse

Conversation

@cixzhang

@cixzhang cixzhang commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Primary intent

Fix: on iPhone and iPad, a tap no longer opens a HoverCard or Tooltip whose trigger the tap leaves under the finger.

Stacked on #12591 (the shared modality store's focus-ring switch). This PR no longer changes the modality store, so it does not need #12591's code; it stays stacked for its history. Until #12591 merges, this diff includes its commits; compare against #12591's head.

User or maintainer impact

  • People on iPhone or iPad who tap a control that moves a HoverCard or Tooltip trigger under the finger (for example, a tap that opens a sheet whose info icon lands where the finger lifted):
    • Before: the card or tooltip opened from the tap's compatibility mouse events, even with touchTrigger="none", and nothing closed it.
    • After: nothing opens. A tap on a trigger still follows its touchTrigger setting.
  • Mouse and pen users, including on a hybrid device right after a tap: unchanged. Hover opens after the delay as before.

Expected behavior and authority

  • architecture:interaction-modality INV11: hover intent answers mouse and pen hover only; a finger is never gated or served by it. INV4: hover is never the only path, and a tap follows the trigger's touch rule.
  • component:HoverCard FR4 and FR5, and component:Tooltip's touchTrigger: a tap opens a card only through the tap path.

The change

  • utils/inputStream.ts (unchanged): the shared input stream already records the last pointer's type (getLastPointerType, which Layer's input hold and TopNav read). A mouse or pen sends pointerover before its mouseover, and a tap's compatibility mouse events have no pointer of their own.
  • Layer/useTouchTrigger.ts: while a hover trigger is mounted, useTouchTriggerInternal subscribes pointerover and pointerdown through subscribeInput in its window, so the stream hears the pointer type (one shared native listener per type, no listener of its own). It answers isTouchHover() once for the hover layers: the trigger's own pointer is a finger, or the document's last pointer was a finger; before the page has heard any pointer, a device with no pointer that can hover ((any-hover: none), as on a phone) counts too. A heard mouse or pen always hovers. The trigger's own mouse arrival (handleMouseArrival()) marks a finger's compatibility arrival on a trigger that saw no pointer of its own, and its mouse departure (handleMouseDeparture(), the next tap's compatibility mouseleave) clears the mark; isTouchInteraction(), which the focus paths read, then counts the focus that tap gives that trigger as touch (with no navigation key since). Focus that script moves to a trigger after a tap elsewhere is not marked, so it still opens the layer (Tooltip FR4 and FR13, HoverCard FR4 and FR12).
  • HoverCard/useHoverCard.tsx (now on useTouchTriggerInternal, as Tooltip is) and Tooltip/useTooltip.tsx: only the mouse-enter handlers (and HoverCard's card-surface enter) gate on isTouchHover(). The leave handlers keep the trigger's own pointer check, so a mouse-opened layer still closes on the compatibility mouseleave of a tap elsewhere.
  • No public API change.
  • Known gap: on a device that has both a finger and a mouse (a touch laptop, an iPad with a trackpad), a tap whose handler mounts the first Core hover trigger under the finger on a page where nothing yet subscribes the input stream's pointer events still opens it: the stream hears only while a subscriber is mounted, and that press came first. Phones and tablets with no mouse are covered by (any-hover: none).

Evidence

  • Red first: the new HoverCard and Tooltip cases "opens nothing when a tap elsewhere leaves the trigger under the finger" fail on the base (the card or tooltip opens from mouseover/mouseenter/mousemove after a touch on another control) and pass here. HoverCard's case also focuses the trigger, as Chromium does for a tapped button. The same cases then move a mouse onto the trigger (pointerover with pointerType: 'mouse') and check that hover still opens: the hybrid-device path.
  • Leave still closes: new cases "closes a mouse-opened card/tooltip on the compatibility mouseleave of a tap elsewhere". A Tab after an earlier tap elsewhere, focus that script moves after a tap elsewhere, and focus that a later tap moves by script after a tap once left the trigger under the finger, all still open a HoverCard on focus. HoverCard also checks that, on a device with no pointer that can hover, a mouse arrival with no pointer heard opens nothing, and a mouse that announced itself with pointerover still opens it.
  • Real browser: Tooltip/__tests__/TouchCompatibilityHover.a11y.chromium.spec.ts (Tooltip and HoverCard default stories, touch-enabled Chromium): a real tap on a control whose pointer release moves the trigger under the finger sends the trigger compatibility mouseover events (checked) and opens nothing; a mouse then opens it, and after it closes, a pen (CDP pointerType: 'pen') opens it. It runs in CI's Chromium contract leg.
  • Unchanged paths: HoverCard, Tooltip, Layer, utils, Field, CheckboxInput and IconButton suites pass, with TreeList and TopNav (2,822 tests). Typecheck and lint are clean.
  • Size (pnpm size:pages, gzip, the four reference pages, this PR's own change from fix(core): shared and disabled-field focus rings show for keyboard focus only #12591's head 7a5ea5d): docs +289 B, form +288 B, menu +325 B, table +291 B; Tooltip page +313 B, HoverCard page +274 B. The touch-hover gate is default behavior, so architecture:component-import-boundaries INV10's 0.3 KB cap for optional features does not apply (DEC-5); these are the deltas INV10 asks a shared-module change to report. Every reference page already loads utils/inputStream.ts on the base, through press feedback, so the growth is the touch trigger's new gate, its arrival mark and its stream subscription.
  • Device (iOS Simulator, iPhone 17 Pro, iOS 26.2 Safari, real HID taps; 24f5724 against main 432354a): a constructed page, the same on both builds, where a tap on one control drops a HoverCard or Tooltip trigger under the finger; a take counts only when the dropped trigger heard all six compatibility events (mouseover, mouseenter, mousemove, mousedown, mouseup, click). Card trigger under the finger: main opened the card 6 of 6, this branch 0 of 6. Hint trigger: main 6 of 6, this branch 0 of 6. A tap whose handler focuses a trigger by script opens it on both, 3 of 3. Two taps (the first drops the trigger, the second's handler focuses it by script): main opens at the first tap, this branch opens nothing at the first and opens at the second, 3 of 3. Direct taps on a hint-only Tooltip and an info trigger open on both; desktop mouse hover opens on both. This head changes 24f5724's runtime only in where it reads the last pointer type (the shared input stream instead of a store copy); the same reading, so the take stands.
Simulator frames (24f5724 against main 432354a)
main This branch
Card trigger dropped under the finger main: the card opens over the dropped trigger This branch: nothing opens
Hint trigger dropped under the finger main: the tooltip opens This branch: nothing opens
Script focus after a tap main: opens This branch: opens
Two taps, after the first main: opens at the first tap This branch: nothing opens at the first tap
Two taps, after the second main: open This branch: opens at the second tap

Scope

Components: HoverCard, Tooltip (and the shared Layer touch trigger they use)

  • One defect is restored.
  • No new public API, visual representation, default, or interaction model is hidden under the bug-fix label.
  • Public text and artifacts contain no internal Meta context.

Overlap checked: #12591 (stacked on it: its files appear here only through the merge of its branch; this PR's own change is the touch-pointer fact in the shared store plus HoverCard's and Tooltip's mouse handlers, a separate defect; other open PRs that touch these files change other lines)

Browsers match :focus-visible on a text field whatever the input, and
WebKit on an element focused by script, so a tap or a click that focused
a disabled field, or opened a sheet whose row takes focus, painted a ring
(interaction-modality INV1, AST-085 FR6).

The modality store now sets one private custom property on each
document's root, --astryx-focus-ring: 0 after a pointer press, cleared
after a navigation key (unset reads as 1, so server markup and a page
with no input yet keep keyboard rings). The shared rings scale by it:
focusOutlineStyles and the focus-owner ring multiply their outline width,
and the disabled-field rings mix their border back to the rest color and
zero their inset shadow. Text fields start the store through
useFieldInputStyling, so a disabled field alone on a page is covered.
Tests that pinned the ring's exact declarations are updated.
…operty form

A leading underscore marks an implementation-protocol custom property that
themes do not set, as --_container-bleed-block-* and --_section-padding-
propagated are. Still a typed defineVars number (stylex.types.number).
…b included

Safari moves focus with Option+Tab, which the store ignored as a
modifier press, so the rings stayed off after a click. Tab now counts as
keyboard input whatever is held. Any key that makes the modality keyboard
turns the rings on, typing included, as INV1 says.
…ocus-ring, 1)

No exported vars object: focusRingVars made the switch reachable from the
package's focusOutline.stylex export (public-component-api INV12). The
ring styles now read Core's underscore property literally, with fallback
1, and the modality store sets it by name. focusOutlineStyles keeps the
public type it had before the gate. Adds a forced-colors keyboard-focus
check.
…r Tooltip

iOS sends mouseover, mouseenter and mousemove after a tap, also to an element that moved under the finger and saw no pointer of its own. The shared interaction-modality store now records the last pointer's type (pointerdown, and a passive capture pointerover, which a mouse or pen sends before its mouseover). HoverCard and Tooltip ignore hover while the last pointer was a finger. A store an older bundle made answers 'not touch', which keeps today's behavior.
@vercel

vercel Bot commented Nov 18, 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 18, 2026 4:13pm UTC

Request Review

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

astracat-bot Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟡 Reviewed (for maintainers only) Nov 18, 2026, 11:56 PM UTC

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

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

… is a tracked name

isLastPointerTouch joins the modality-tracking concern, its pointerover listener joins the listener pattern, and the concern claims INV11, the hover-intent rule the reader serves.
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec b0a8c4d

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 18, 2026
The record says a key with Meta, Alt or Control held leaves the modality
alone; a Tab with them (Safari's Option+Tab) still moves focus, so it now
only clears the ring switch. INV6 names that case. Test expectations take
StyleX's emitted var(--_focus-ring,1), and the two Wheel snapshots are
regenerated at this head.
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 846a801

@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 moved-trigger tap no longer opens HoverCard or Tooltip when Core is already tracking input, but the fix misses pages where it is not, changes how hover-opened layers close, and needs a few corrections.

Blocking

  • The fix only works when another Core component was already tracking input when the finger went down: in Chromium, a tap whose handler mounts a touchTrigger="none" Tooltip under the finger on an otherwise untracked page still opens it, while the changeset says such a tap no longer does; narrow the claim and record the gap, or make the store hear the press before a hover layer mounts.
  • Where the next tap sends the trigger a compatibility mouseleave (as both hooks' comments say touch does), a HoverCard or Tooltip that a mouse hover opened no longer closes when a finger taps elsewhere, because the mouse-leave handlers now return early after any finger press and a hover-opened layer arms no outside dismissal (useTooltip.tsx:538, useHoverCard.tsx:420 and :724); gate only the enter handlers on the document's last pointer.
  • The same isTouchHover check is added to both useHoverCard.tsx and useTooltip.tsx instead of once in Layer/useTouchTrigger.ts, which already owns the hover layers' touch state; answer it there on the internal return, have HoverCard use useTouchTriggerInternal as Tooltip does, and delete both copies.
  • .changeset/focus-rings-keyboard-only.md says "Focus rings show for keyboard focus only", but only the shared, focus-owner and disabled-field rings change; reword it to name those rings.

Also needed before approval

  • A real-browser case for the hover fix: a tap that moves a touchTrigger="none" trigger under the finger, then a mouse and a pen hovering it, as the interaction-modality record asks for behavior that depends on touch synthesis.
  • First-load gzip deltas for the whole pull request against main on the four reference pages; the description measures from #12591's head.
Claims and files checked

Review mode: full; reason: no-earlier-review

Claims:

  • A tap that leaves a trigger under the finger no longer opens HoverCard or Tooltip: verified in unit tests (the new cases fail on the merge base and pass here) and in Chromium when a Core tracker was mounted before the tap; false when the trigger mounts as the page's first tracker.
  • Mouse and pen users, hybrid devices included, are unchanged: false under the tests' own event model; a mouse-opened layer stays open after a finger tap elsewhere (Chromium's touch emulation sends no compatibility mouseleave, so both sides stay open there).
  • The store records the last pointer type from pointerdown and one passive capture pointerover listener that writes one field: verified (interactionModality.ts:103, :112, :193-198).
  • A store made by an older bundle answers false: verified (interactionModality.ts:417-430).
  • The mouse enter and leave handlers, and the card surface's, skip while either pointer was a finger: verified (useHoverCard.tsx:411, :420, :717, :724; useTooltip.tsx:527, :538).
  • The record's front matter names the reader, widens the listener pattern and claims INV11: verified (interaction-modality.md:45-57).
  • No public API change: verified; the API report's one row for focusOutlineStyles is the same type written through a local alias.
  • The same cases check that a later mouse still hovers: verified.
  • The listed suites pass, typecheck and lint are clean: 2,888 tests in 54 related files pass here, Core's build typechecks, and lint on the changed files reports no errors (two warnings in the new browser spec).
  • Size deltas from #12591's head: not re-measured; whole-PR deltas from the merge base are +203 B, +462 B, +258 B and +270 B gzip on the four pages.
  • Knowledge check aligned: verified.
  • Hover changeset (iPhone and iPad taps no longer open; mouse and pen still hover after a tap): broader than the change (see above); a later mouse hover still opens, verified.
  • Focus-ring changeset: its first sentence is broader than the change (see above); the disabled-field and sheet-row cases match the code.

Files (31):

  • HoverCard/useHoverCard.tsx, Tooltip/useTooltip.tsx: findings above.
  • .changeset/focus-rings-keyboard-only.md, .changeset/hover-ignores-tap-compat-mouse.md: findings above.
  • utils/interactionModality.ts: finding above (the reader depends on listeners an earlier tracker started).
  • docs/architecture/interaction-modality.md: clear.
  • HoverCard.test.tsx, Tooltip.test.tsx, utils/interactionModality.test.ts: clear; no case covers the hybrid leave path.
  • utils/focusOutline.stylex.ts, privateAttributes/focusOwner.stylex.ts, Field/inputDisabledFocus.ts, Field/fieldParts.ts: clear; two comments could be shorter.
  • utils/__tests__/FocusRingModality.a11y.browser.spec.ts, apps/storybook/stories/BottomSheet.stories.tsx: clear.
  • 14 ring and markup test updates (DateRangeInput, DateTimeInput, Dialog, DropdownMenuForcedColors, two MultiSelector, NumberInput, two Selector, TextArea, TextInput, TimeInput, TreeList, Typeahead) and 2 Wheel snapshots: clear; they pin the gated values and pass here.

Automated review (maintainer link)

Comment thread .changeset/focus-rings-keyboard-only.md Resolved
Comment thread packages/core/src/Field/fieldParts.ts Resolved
…rowser shows the rings

After a click, Tab out of an iframe (or from the browser's interface) moved
focus into this document with no key event here, so the rings stayed off.
After the first pointer press the store also hears the window's blur: it
notes whether focus left for a child frame or the window, and the next
focusin, unless a press comes first, turns the rings back on. The window
giving focus back to the element it left from is a restore and keeps them
as they were. The changeset names the rings this changes, and four source
comments are shorter.
… and cover devices without hover

useTouchTriggerInternal answers isTouchHover for both hover layers: the trigger's own finger, the document's last pointer as a finger, or (any-hover: none). HoverCard moves to useTouchTriggerInternal. Only the enter handlers gate on it, so a mouse-opened layer still closes on a tap's compatibility mouseleave. A real-browser spec covers the moved-trigger tap and the mouse and pen hover after it. The changeset names the gap on hybrid devices.
# Conflicts:
#	packages/core/src/utils/interactionModality.test.ts
#	packages/core/src/utils/interactionModality.ts
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec a08f299

…eard pointer outranks the media query

isTouchInteraction counts focus a finger press gave anywhere in the document, with no navigation key since, so HoverCard's focus path no longer opens on a tap that moved its trigger under the finger. isTouchHover reads (any-hover: none) only before the page has heard a pointer, so a mouse or pen that announced itself with pointerover still hovers. The store's reader becomes getLastPointerType. The browser spec scopes its locator to the layer and checks that the compatibility mouseover reached the trigger.
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 18, 2026
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 8d12af8

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

Copy link
Copy Markdown
Contributor Author

/approve-spec 71124da

…nsumer

With no listener left there, nothing could turn the rings back on, so
keyboard focus in an iframe or Picture-in-Picture window drew no shared
ring after a pointer press. The last release drops the override in a
microtask, so an object-ref consumer that releases and holds again in one
commit keeps 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: a tap that leaves a Tooltip or HoverCard trigger under the finger no longer opens it and mouse and pen hover still work, but focus that script moves after a tap elsewhere no longer opens a layer the component specs say opens, and the branch fails a TreeList test once merged with main.

Blocking

  • The widened isTouchInteraction in Layer/useTouchTrigger.ts treats any focus after a finger press anywhere as tap focus, so a tap that focuses a text field wrapped in a Tooltip, or a HoverCard trigger, by script no longer opens the layer (it does on main), against Tooltip FR4 and FR13 and HoverCard FR4 and FR12; count the last finger only for focus the tap itself gives the trigger (for example a mousedown on it with no pointerdown of its own), or have an owner amend those clauses, and mention the wider useTouchTrigger().isTouchInteraction() answer in the changeset.
  • Regression: once merged with current main, the TreeList case "draws the focus ring on a plain row that has keyboard focus" (TreeList.test.tsx:447, added by #12153) fails because it expects the unscaled --_focus-outline that this branch now scales by --_focus-ring; merge main and update that assertion as this branch already does for the other TreeList ring case.

The earlier HoverCard focus, (any-hover: none) and browser-spec findings are fixed, and the new Chromium spec passes.

Claims and files checked

Review mode: full; reason: spec-record

Claims:

  • A tap that leaves a trigger under the finger no longer opens HoverCard or Tooltip on a phone or tablet: verified (new unit cases fail on the base and pass here; the new Chromium spec passes; touch-enabled Chromium frames show the base opening both layers and this branch neither).
  • On a device with a mouse too, the same holds once a Core component has seen a press: verified in unit tests (the store starts with its first consumer, as the known gap says).
  • A mouse or pen still hovers, also right after a tap: verified (unit cases; the Chromium spec's mouse and pen steps under touch emulation pass).
  • The shared, focus-owner and disabled-field rings show for keyboard focus only, including focus back from a frame or the browser, and component rings are unchanged: verified (the ring browser spec passes in Chromium; unit tests); WebKit was not run.
  • The store records the last pointer type from the press listener and one passive capture pointer-over listener that writes one field: verified (interactionModality.ts).
  • The new reader returns the type, or nothing before any pointer or in a store an older bundle made: verified.
  • The touch helper answers touch hover from the trigger's pointer and the document's last pointer, with the no-hover media query only before any pointer: verified (useTouchTrigger.ts).
  • The focus check also counts focus that a finger press elsewhere gave: verified as written, but it also blocks focus that script moves after a tap elsewhere (first finding).
  • HoverCard uses the internal helper as Tooltip does, only the enter handlers gate on touch hover, and the leave handlers keep the trigger's own check: verified.
  • The record's front matter names the reader, widens the listener pattern and claims the hover-intent invariant: verified; through the merged branch the focus-modality invariant also gains a sentence.
  • No public API change: verified for signatures (the generator's one row is the same type through a local alias); the public touch hook's focus answer widens (first finding).
  • New cases fail on the base and pass here: verified (three fail on the base).
  • Leave still closes, Tab after a tap still opens a HoverCard, and a no-hover device ignores an unannounced mouse: verified in unit tests.
  • The real-browser spec shows a tap opening nothing and then a mouse and a pen opening the layer: verified (passes in Chromium here).
  • The listed suites pass and typecheck and lint are clean: suites verified (203 files, 5,903 tests); Core typecheck and lint on the 28 changed code files exit 0.
  • The modality tests list the pointer-over listener: verified.
  • Whole-branch size against the merge base (docs +502 B, form +732 B, menu +554 B, table +526 B gzip): verified within 30 B (+503, +745, +584, +552); the own-change share was not measured.
  • A device take will be added: not in the pull request; not required here.
  • Knowledge check aligned: verified.
  • Hover changeset: all three sentences verified as above; it does not mention the touch hook's wider focus answer (first finding).
  • Focus-ring changeset: verified as above.
  • The fix restores one defect and hides no new interaction model under the fix label: false for focus that script moves after a tap elsewhere (first finding).
  • Public text carries no internal context: verified.
  • Overlap with other open pull requests: not checked here.

Files (33):

  • Layer/useTouchTrigger.ts: first finding; the helper still detaches the hook's JSDoc, and the touch-hover JSDoc is one 60-word sentence (non-blocking).
  • utils/focusOutline.stylex.ts, TreeList/TreeList.test.tsx: second finding (fails with current main's new TreeList case).
  • HoverCard/useHoverCard.tsx, Tooltip/useTooltip.tsx: first finding (their focus paths read the widened check).
  • .changeset/hover-ignores-tap-compat-mouse.md: first finding (silent on the touch hook).
  • docs/architecture/interaction-modality.md: the new sentence omits the frame and window focus return (non-blocking).
  • Field/fieldParts.ts: second documents stay untracked (non-blocking).
  • utils/interactionModality.ts, .changeset/focus-rings-keyboard-only.md: clear.
  • HoverCard.test.tsx, Tooltip.test.tsx, utils/interactionModality.test.ts, Tooltip/__tests__/TouchCompatibilityHover.a11y.chromium.spec.ts: clear.
  • privateAttributes/focusOwner.stylex.ts, Field/inputDisabledFocus.ts: clear.
  • utils/__tests__/FocusRingModality.a11y.browser.spec.ts, apps/storybook/stories/BottomSheet.stories.tsx: clear.
  • 13 ring and markup test updates (DateRangeInput, DateTimeInput, Dialog, DropdownMenuForcedColors, two MultiSelector, NumberInput, two Selector, TextArea, TextInput, TimeInput, Typeahead) and 2 Wheel snapshots: clear.

Automated review (maintainer link)

* hovering pointer: the trigger's own pointer is a finger, the document's
* last pointer was a finger (a tap's compatibility mouse events also reach
* a trigger that moved under the finger), or, before the page has heard
* any pointer, the device has no pointer that can hover. Gate hover-opening on it; a leave keeps the trigger's own

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 JSDoc is one 60-word sentence, and this line runs to 117 characters. Suggested: "Whether a mouse arrival on the trigger comes from a finger. The trigger's own finger counts, and so does a last document pointer that was a finger. Before the page hears any pointer, a device with no pointer that can hover counts. Gate hover-opening on it. A leave keeps the trigger's own check, so a mouse-opened layer still closes."

… again

An object-ref consumer in a second document releases and holds again after
every commit; the release removed the window's blur listener and the hold
never added it back, so focus returning there by keyboard after a press
showed no ring on its first stop. Listening that resumes while the switch
is 0 now hears the window too.
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 6fe7dc5

@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 moved-trigger tap no longer opens HoverCard or Tooltip, and the two commits merged from #12591's branch since the last review look correct, but both defects from the last review are still present at this head.

  • isTouchInteraction in Layer/useTouchTrigger.ts (lines 483-489) treats any focus after a finger press anywhere in the document as tap focus, so focus that script moves after a tap on another control no longer opens a text-entry Tooltip trigger or a HoverCard, which the Tooltip and HoverCard specs say it does (Tooltip FR4 and FR13, HoverCard FR4 and FR12); count the finger only for focus the tap itself gives the trigger, and add a test for each case.
  • Regression: merging current main fails TreeList.test.tsx:447, whose plain-row case still expects the ungated --_focus-outline that focusOutline.stylex.ts:247 now gates; merge main and update that assertion as the other TreeList ring case was updated.

The non-blocking notes (two JSDoc placements in useTouchTrigger.ts, the INV6 sentence, and the Field tracker's dropped ref) are in the open review threads.

Claims and files checked

Review mode: incremental; reason: none

  • Changed rules (0): none.

Claims:

  • A tap that leaves a HoverCard or Tooltip trigger under the finger opens nothing, also with touch trigger none: verified, the new unit cases pass at this head.
  • Mouse and pen hover is unchanged, also right after a tap: verified by the unit cases' mouse steps; the browser spec's mouse and pen steps did not run in CI for this draft.
  • The modality store records the last pointer type from pointer down and a passive pointer-over listener, and a new reader returns it or nothing: verified (interactionModality.ts:136-149, :521-536).
  • The hover layers answer touch hover once; before any pointer, a device with no hovering pointer counts, and a heard mouse or pen always hovers: verified (useTouchTrigger.ts:491-502).
  • The focus check also counts focus a finger press elsewhere gave: true as written, and it also blocks script focus after a tap elsewhere (blocking finding).
  • Only the enter handlers use the touch-hover answer; the leave handlers keep the trigger's own check: verified (useHoverCard.tsx:404, :413, :710, :717; useTooltip.tsx:520, :531).
  • The record's front matter names the new reader, widens the listener pattern and claims the hover-intent rule: verified.
  • No public API change: verified for exports and types; the public hook's focus answer widens (blocking finding).
  • Red first on the base, leave still closes, Tab after a tap still opens a HoverCard, and the no-hover-device cases: the cases pass at this head; the red-first run was checked in the last review and these tests are unchanged since.
  • The browser spec runs in CI's Chromium leg: CI has not run for this draft head.
  • The named suites pass: verified, HoverCard, Tooltip, Layer, TreeList, utils, Field, CheckboxInput, IconButton and others pass at this head.
  • Typecheck and lint are clean: not checked in this review.
  • Bundle-size deltas on the four reference pages: reported in the description; not re-measured after the two newly merged commits.
  • Hover changeset (phone or tablet tap no longer opens; hybrid devices once a Core component saw a press; mouse and pen still hover): verified.
  • Ring changeset (shared and disabled-field rings show for keyboard focus only, including focus returning from a child frame or the browser; component-owned rings unchanged): verified by the modality and ring markup tests.

Files:

  • Layer/useTouchTrigger.ts: blocking (the widened focus answer); two non-blocking JSDoc notes.
  • utils/focusOutline.stylex.ts: regression once merged with current main (TreeList plain-row assertion).
  • docs/architecture/interaction-modality.md: non-blocking (the INV6 sentence omits two ways the ring switch clears).
  • Field/fieldParts.ts: non-blocking (the tracker's ref is dropped).
  • Clear: both changesets, BottomSheet.stories.tsx, Field/inputDisabledFocus.ts, HoverCard/useHoverCard.tsx, Tooltip/useTooltip.tsx, privateAttributes/focusOwner.stylex.ts, utils/interactionModality.ts, utils/interactionModality.test.ts, HoverCard.test.tsx, Tooltip.test.tsx, TouchCompatibilityHover.a11y.chromium.spec.ts, FocusRingModality.a11y.browser.spec.ts, TreeList.test.tsx, the two DateInput snapshots, and the ring-assertion updates in the DateRangeInput, DateTimeInput, Dialog, DropdownMenuForcedColors, MultiSelector (two), NumberInput, Selector (two), TextArea, TextInput, TimeInput and Typeahead tests.

Automated review (maintainer link)

…rd-only

TreeList's plain-row ring case, new on main, expects the ring width that
the shared ring switch scales, as the branch's other TreeList case does.
…ts as touch

A finger's compatibility arrival on a trigger that saw no pointer of its own marks it, and isTouchInteraction counts the last finger only for that trigger, so focus that script moves after a tap elsewhere still opens a Tooltip or HoverCard (Tooltip FR4/FR13, HoverCard FR4/FR12). The changeset names the wider isTouchInteraction answer.
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec b820d0f

@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: both defects from the last review are fixed (focus that script moves after a tap elsewhere opens the card again, and the TreeList ring case passes after the merge of main), but two new ones need fixing.

  • After a tap once leaves a trigger under the finger, isFingerArrivalRef in Layer/useTouchTrigger.ts (lines 517-521) stays set until that trigger's own next pointer event, so focus that a later tap's handler moves to the trigger opens no HoverCard or text-entry Tooltip, although Tooltip FR4 and HoverCard FR4 say it opens; clear the mark when that tap ends (for example on the trigger's mouseleave) and add the second-tap case as a test.
  • .changeset/hover-ignores-tap-compat-mouse.md says useTouchTrigger().isTouchInteraction() now answers true for the moved trigger's tap focus, but the public hook has no mouse-arrival handler and answers exactly as before; drop that sentence or say that HoverCard and Tooltip count that focus as touch.

The non-blocking notes (JSDoc placement and length in useTouchTrigger.ts, the INV6 sentence, the Field tracker's dropped ref, and naming Layer and utils on the Scope line) are in the review threads and the review.

Claims and files checked

Review mode: incremental; reason: none

  • Changed rules (0): none.

Claims:

  • A tap that leaves a HoverCard or Tooltip trigger under the finger opens nothing, also with touch trigger none: verified (new unit cases pass; touch-enabled Chromium, both default stories).
  • A tap on a trigger still follows its touch-trigger setting: verified (existing touch suites pass).
  • Mouse and pen hover is unchanged, also right after a tap: verified by the unit cases; the browser spec's mouse and pen steps did not run in CI for this draft.
  • The modality store records the last pointer type from pointer down and a passive pointer-over listener, and a new reader returns it or nothing: verified (interactionModality.ts).
  • The hover layers answer touch hover once; before any pointer, a device with no hovering pointer counts, and a heard mouse or pen always hovers: verified (useTouchTrigger.ts:504-515).
  • A finger's arrival on a trigger that saw no pointer of its own makes the focus that tap gives count as touch: true, but the mark outlives that tap (blocking finding).
  • Focus that script moves to a trigger after a tap elsewhere still opens it: verified for a trigger the finger never reached; false after an earlier tap left the trigger under the finger (blocking finding).
  • Only the enter handlers use the touch-hover answer; the leave handlers keep the trigger's own check: verified (useHoverCard.tsx:405, :414, :711, :718; useTooltip.tsx:520, :531).
  • The record's front matter names the new reader, widens the listener pattern and claims the hover-intent rule: verified.
  • No public API change: verified.
  • Known gap on a device with both a finger and a mouse before any Core component listens: consistent with the code (the store listens from its first consumer).
  • Red first on the base: the base opens both layers on the moved-trigger tap in touch-enabled Chromium; the unit cases were not rerun on the base in this review.
  • Leave still closes, a Tab after a tap and script focus after a tap open a HoverCard, and the no-hover-device cases: verified, the cases pass at this head.
  • The browser spec runs in CI's Chromium contract leg: CI has not run for this draft head.
  • The named suites pass: verified (HoverCard, Tooltip, Layer, TreeList, utils, Field and the ring-assertion suites pass at this head).
  • Typecheck and lint are clean: not checked in this review.
  • Bundle-size deltas on the four reference pages: reported in the description; not re-measured after the latest commit.
  • A device take will be added: not stated yet.
  • Hover changeset, phone or tablet tap and hybrid devices once a Core component saw a press: verified; mouse and pen still hover: verified; script focus still opens: false after an earlier landing (blocking finding); the public focus-answer sentence: false (blocking finding).
  • Ring changeset (shared and disabled-field rings show for keyboard focus only, including focus returning from a child frame or the browser; component-owned rings unchanged): verified by the modality and ring markup tests.

Files:

  • Layer/useTouchTrigger.ts: blocking (the finger-arrival mark); non-blocking JSDoc notes and a behavior tag-along note.
  • .changeset/hover-ignores-tap-compat-mouse.md: blocking (the public hook claim).
  • utils/interactionModality.ts: non-blocking (behavior tag-along note for the Scope line).
  • docs/architecture/interaction-modality.md: non-blocking (the INV6 sentence omits two ways the ring switch clears).
  • Field/fieldParts.ts: non-blocking (the tracker's ref is dropped).
  • Clear: .changeset/focus-rings-keyboard-only.md, BottomSheet.stories.tsx, Field/inputDisabledFocus.ts, HoverCard/useHoverCard.tsx, Tooltip/useTooltip.tsx, privateAttributes/focusOwner.stylex.ts, utils/focusOutline.stylex.ts, utils/interactionModality.test.ts, HoverCard.test.tsx, Tooltip.test.tsx, TouchCompatibilityHover.a11y.chromium.spec.ts, FocusRingModality.a11y.browser.spec.ts, TreeList.test.tsx, the two DateInput snapshots, and the ring-assertion updates in the DateRangeInput, DateTimeInput, Dialog, DropdownMenuForcedColors, MultiSelector (two), NumberInput, Selector (two), TextArea, TextInput, TimeInput and Typeahead tests.

Automated review (maintainer link)

handleMouseDeparture clears the finger-arrival mark on the trigger's mouse departure, so focus that a later tap moves by script opens the layer again (Tooltip FR4, HoverCard FR4). The changeset says HoverCard and Tooltip count the tap's focus as touch; the public hook's answer is unchanged.
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 24f5724

@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. One duplication still needs a change:

  • Miss: utils/interactionModality.ts adds a second getLastPointerType, fed by its own pointerover listener and store field, beside the existing getLastPointerType in utils/inputStream.ts that Layer/inputHold.ts and TopNav already read, so take the pointer type from the input stream (subscribe pointerover and pointerdown through subscribeInput) and drop the copy, or say in the description why the stream cannot serve this case.

The hover and focus fix itself behaves as described: a tap that leaves a HoverCard or Tooltip trigger under the finger opens nothing, while mouse and pen hover and a later tap's script focus still open the layer. Non-blocking notes on the useTouchTriggerInternal JSDoc placement, the isTouchHover JSDoc and the INV6 wording remain in their open threads.

Claims and files checked

Review mode: same-head; reason: none

  • Claim: a tap that leaves a HoverCard or Tooltip trigger under the finger opens nothing, and the focus it gives counts as touch for both: verified (new unit cases; touch-enabled Chromium, both default stories).
  • Claim: a mouse or pen still hovers, also right after a tap, and a mouse-opened layer still closes on a tap elsewhere: verified (unit cases).
  • Claim: focus that script moves to a trigger after a tap still opens it: verified (Chromium second-tap capture; HoverCard unit case; text-field Tooltip probe).
  • Claim: on a device with a mouse, the gate holds once the store hears a press; phones are covered by the no-hover media query: verified (isTouchHover).
  • Claim: the store records the pointer type from pointerdown and a passive pointerover, and the reader answers undefined before any pointer: verified; it duplicates the input stream (finding above).
  • Claim: only the enter handlers gate on touch hover, and the leave handlers keep the trigger's own check: verified.
  • Claim: the record's front matter names the reader, widens the listener pattern and claims the hover-intent rule: verified.
  • Claim: no public API change: verified.
  • Claim: the shared and disabled-field rings show for keyboard focus only, including focus back from a frame or the browser: verified in unit tests; the browser spec has not run at this head.
  • Claim: the unchanged suites pass: verified (123 files, 2,641 tests).
  • Claim: the Chromium spec runs in CI's Chromium contract leg: verified in the Playwright config; CI has not run on this draft.
  • Claim: first-load size deltas on the four reference pages: reported, not re-measured.
  • Claim: the device take predates this head and a retake is booked: stated in text, not required.
  • Claim: the rubric results cover a front-matter-only record change: true for this pull request's own commits; the carried INV6 sentence has none.
  • File utils/interactionModality.ts: duplicate last-pointer reader (blocking); the ring switch and focus return are clear.
  • File Layer/useTouchTrigger.ts: JSDoc placement and length (non-blocking); the logic is clear.
  • File docs/architecture/interaction-modality.md: INV6 omits two ways the rings return (non-blocking).
  • File Field/fieldParts.ts: the tracker's ref is dropped (non-blocking).
  • Files HoverCard/useHoverCard.tsx, Tooltip/useTooltip.tsx, Field/inputDisabledFocus.ts, utils/focusOutline.stylex.ts, privateAttributes/focusOwner.stylex.ts, both changesets and the BottomSheet story: clear.
  • Files HoverCard.test.tsx, Tooltip.test.tsx, interactionModality.test.ts, TreeList.test.tsx, Dialog.test.tsx, DropdownMenuForcedColors.test.tsx, the DateRangeInput, DateTimeInput, MultiSelector (2), NumberInput, Selector (2), TextArea, TextInput, TimeInput and Typeahead ring assertions, and both browser specs: clear.
  • Files: the two DateInput snapshots: clear (class-name churn only).

Automated review (maintainer link)

…ed input stream

The modality store's second lastPointerType, its pointerover listener and getLastPointerType copy are gone, with the record touch they needed. useTouchTriggerInternal subscribes pointerover and pointerdown through subscribeInput while a hover trigger is mounted, and reads inputStream's getLastPointerType, which Layer's input hold and TopNav already read.
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec be6fb12

@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 hover fix behaves as described and the earlier description corrections are in, but one statement in the description is still false (no code change is needed).

  • Miss: the Scope section's Overlap line says this pull request's own change is "the touch-pointer fact in the shared store plus HoverCard's and Tooltip's mouse handlers", but on top of #12591 it changes only Layer/useTouchTrigger.ts, the two hooks' mouse handlers, their tests, the Chromium spec and the hover changeset, and no store, which also contradicts the description's own "This PR no longer changes the modality store"; suggested wording: "this PR's own change is the touch trigger's touch-hover gate and arrival mark (Layer/useTouchTrigger.ts) plus HoverCard's and Tooltip's mouse handlers".

The size figures, the explanation of the growth and the test-list sentence now match this head. The non-blocking notes on the helper JSDoc in Layer/useTouchTrigger.ts and on the INV6 wording stay in their threads, and CI has not run on this draft yet.

Claims and files checked

Review mode: same-head; reason: none

  • Claim: a tap that leaves a HoverCard or Tooltip trigger under the finger opens nothing, even with touchTrigger="none": verified (new unit cases fail on the base and pass here; touch-enabled Chromium on both default stories).
  • Claim: a direct tap on a trigger still follows touchTrigger: verified (existing touch suites pass).
  • Claim: mouse and pen still hover, also right after a tap on a hybrid device: verified for a mouse (unit cases and Chromium); pen by code, as the new Chromium spec has not run.
  • Claim: this pull request no longer changes the modality store and does not need #12591's code: verified (its own change on top of #12591 applies cleanly to the base and uses only exports the base has).
  • Claim: the input stream is unchanged and already records the last pointer type that Layer's input hold and TopNav read: verified.
  • Claim: the touch trigger keeps the stream listening for pointerover and pointerdown while a hover trigger is mounted, with no listener of its own: verified.
  • Claim: the touch-hover answer covers the trigger's own finger, a last pointer that was a finger, and a device with no hover pointer before any pointer is heard: verified.
  • Claim: a finger's arrival makes the focus that tap gives the trigger touch, the next mouse departure ends it, and script focus after a tap elsewhere still opens the layer: verified (unit cases).
  • Claim: only the enter handlers gate, the leave handlers keep the trigger's own check, and HoverCard moves onto the internal hook as Tooltip uses: verified.
  • Claim: no public API change: verified (API surface comparison and a type-equality check).
  • Claim: the hybrid-device gap the description names: consistent with the code.
  • Claim: red first, leave still closes, keyboard and script focus still open, and the no-hover-device case: verified (unit cases).
  • Claim: the new Chromium spec checks the compatibility mouseover and runs in CI's Chromium contract leg: verified in the spec and the Playwright configuration; it has not run at this head.
  • Claim: the named suites pass, and typecheck and lint are clean: verified (the test count depends on how the suites are filtered; all pass).
  • Claim: the first-load size figures against #12591's head (+289, +288, +325 and +291 B; Tooltip +313 B, HoverCard +274 B): verified.
  • Claim: every reference page already loads the input stream on the base, so the growth is the gate, the arrival mark and the subscription: verified.
  • Claim: the gate is default behavior, so the optional-feature cap does not apply, and these are the shared-module deltas to report: verified.
  • Claim: the simulator take carries to this head: stated in text; no current record requires device evidence for this change.
  • Claim: the scope checklist (one defect, nothing hidden under the fix label, no internal context): verified.
  • Claim: #12591's files appear here only through the merge of its branch: verified.
  • Claim: this pull request's own change is the touch-pointer fact in the shared store plus the mouse handlers: false (finding above).
  • Claim: other open pull requests that touch these files change other lines: not verified (13 other open pull requests also change the hover hooks, their tests or the touch trigger, and their hunks were not compared with this head).
  • Changeset (hover): verified, including the hybrid-device sentence for pages with a field or a pressable.
  • Changeset (focus rings): verified (a click on a disabled field draws no ring, Tab draws it; unit tests cover focus returning from a frame or the window).
  • File Layer/useTouchTrigger.ts: misattached helper JSDoc and a long isTouchHover JSDoc (non-blocking); the logic is clear.
  • Files HoverCard/useHoverCard.tsx and Tooltip/useTooltip.tsx: clear.
  • Files utils/interactionModality.ts, utils/focusOutline.stylex.ts, privateAttributes/focusOwner.stylex.ts and Field/inputDisabledFocus.ts: clear.
  • File Field/fieldParts.ts: the tracker's ref is dropped (non-blocking).
  • File docs/architecture/interaction-modality.md: INV6 omits focus returning from a frame or the window (non-blocking); owner-approved at this head.
  • Files: both changesets and the BottomSheet story: clear.
  • Files HoverCard.test.tsx, Tooltip.test.tsx, interactionModality.test.ts, TreeList.test.tsx, Dialog.test.tsx, DropdownMenuForcedColors.test.tsx, the DateRangeInput, DateTimeInput, MultiSelector (2), NumberInput, Selector (2), TextArea, TextInput, TimeInput and Typeahead ring assertions, and both browser specs: clear.
  • Files: the two DateInput snapshots: clear (class-name churn only).

Automated review (maintainer link)

* @internal
*/
/**
* Whether the trigger's device has no pointer that can hover, as on a phone:

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 JSDoc and useTouchTriggerInternal's JSDoc above it (with its @internal tag) now both precede windowOf, so windowOf reads as "Whether the trigger's device has no pointer that can hover", hasNoHoverPointer has no doc, and the built declaration of useTouchTriggerInternal loses @internal. Move windowOf, lastPointerTypeAt, ignorePointer and hasNoHoverPointer above line 352, with this block directly above hasNoHoverPointer.

@cixzhang cixzhang removed the needs:design-review Affects visuals — Design should review label Nov 20, 2026

This branch was successfully deployed

1 active deployment
Preview — be6fb12f Deployed Nov 18, 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant