Skip to content

feat(lab): SearchField's tab placement, the content a tab bar's search tab holds - #8224

Draft
vjeux wants to merge 1900 commits into
meta:mainfrom
vjeux:uikit/c09-search-tab
Draft

vjeux wants to merge 1900 commits into
meta:mainfrom
vjeux:uikit/c09-search-tab

Conversation

@vjeux

@vjeux vjeux commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Depends on #8216 and its predecessors. Review only this PR's change: vjeux/astryx@fc37107...15991be

User need

iOS 26's tab bar has a search tab whose field the tab bar itself draws and moves. Astryx's TabBar search tab (#8192) needs just the field's content, and a way to cancel from its own button.

Problem and solution fit

What led to it: the UIKit-parity program; #8192 builds the tab bar's search tab on this placement.

  • placement="tab": only the field's content (magnifier, query, clear, the Search key, Escape to cancel), sized to the box the tab bar gives it; no background, close button, motion or keyboard reading.
  • handleRef.cancel(): the close button's path (clear, end editing, onActiveChange(false)), for the tab bar's own cancel button.
  • No page pan: under Safari, a tap on the text and the handle's focus() both focus without Safari's reveal (spec:AST-099 FR4); Chrome on Android keeps its tap.

Current specification

spec:AST-094 FR13; spec:AST-099 FR4. Pending owner review: the tab placement and cancel().

Public delta and caller burden

placement gains 'tab'; SearchFieldHandle gains cancel(). Lab only, so no changeset.

Size (gzip, base → head): SearchField JS 61.20 → 61.27 KB, CSS 1.54 → 1.54 KB.

Design and alternatives

  • The field draws its own cancel button: iOS has one circle that becomes the cancel button, so there would be two.
  • The field moves itself with the keyboard: UIKit moves it on the tab bar's spring, so the motions would disagree.
  • Chosen: the field supplies its content and cancel(); the tab bar owns the glass, every motion and the cancel button (feat(lab): TabBar — a search tab #8192). Tradeoff: in this placement the field looks plain on its own.

Evidence

iOS: tap, no page move

In the clip, the gray glass, the × and the bar's place above the keyboard are the story's stand-ins for the tab bar's.

Scope

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

Testing

What I ran and what it showed (the "In Tab Bar" story):

  1. iOS 26.2 simulator, a real tap on the field: it focuses and the keyboard rises, and the page doesn't move.
  2. Chromium and WebKit browser tests: the tap leaves the page in place; the field rests 36 px above the keyboard through the stand-in bar; the stand-in's × cancels through cancel().
  3. pnpm exec vitest run packages/lab/src: the tab placement draws no background or close button; cancel() clears, blurs and reports; the handle's focus() doesn't scroll.

Local runs are the evidence; no CI run is expected.

@vercel

vercel Bot commented Oct 24, 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 Oct 30, 2026 2:50am UTC

Request Review

@astracat-bot

astracat-bot Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

AI review status for this pull request.

Review status Updated
❓ Needs maintainer input (for maintainers only) Oct 30, 2026, 3:16 AM UTC

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 24, 2026
@vjeux
vjeux force-pushed the uikit/c09-search-tab branch from 695fcc0 to d239c85 Compare October 24, 2026 11:56
@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR

🧪 Sandbox Preview

View Sandbox for this PR

New Components

SearchField (@astryxdesign/lab) · View in Storybook
Metric Value
Entry File (ESM) 253B
Lines of Code 1403
Source Files 4
Complexity Very High (48)
Exports SearchField, type, type
Props Count N/A
Has Tests Yes
Has Stories Yes

Component Size

Component Import before Import after Delta CSS before CSS after Delta
core/AlertDialog 56.9KB 57.0KB +132B 12.4KB 12.4KB 0B
core/AppShell 57.9KB 58.0KB +106B 11.6KB 11.6KB 0B
core/AvatarGroupOverflow 39.9KB 40.0KB +141B 6.4KB 6.4KB 0B
core/Banner 47.8KB 47.9KB +138B 9.9KB 9.9KB 0B
core/BaseTypeahead 54.3KB 54.4KB +120B 9.9KB 9.9KB 0B
core/BreadcrumbItem 66.4KB 66.5KB +123B 11.0KB 11.0KB 0B
core/Button 43.3KB 43.4KB +115B 9.2KB 9.2KB 0B
core/Calendar 54.9KB 55.0KB +130B 10.0KB 10.0KB 0B
core/Carousel 50.2KB 50.3KB +97B 10.2KB 10.2KB 0B
core/ChatComposer 60.6KB 60.7KB +116B 10.8KB 10.8KB 0B
core/ChatComposerInput 55.7KB 55.9KB +113B 10.1KB 10.1KB 0B
core/ChatComposerTokenElement 55.7KB 55.9KB +115B 10.1KB 10.1KB 0B
core/ChatDictationButton 46.5KB 46.6KB +122B 9.5KB 9.5KB 0B
core/ChatLayout 48.8KB 49.0KB +115B 9.9KB 9.9KB 0B
core/ChatLayoutScrollButton 46.4KB 46.5KB +100B 9.6KB 9.6KB 0B
core/ChatSendButton 45.8KB 45.9KB +110B 9.2KB 9.2KB 0B
core/CheckboxInput 49.9KB 50.0KB +119B 9.3KB 9.3KB 0B
core/CheckboxListItem 54.0KB 54.1KB +108B 10.5KB 10.5KB 0B
core/ClickableCard 12.8KB 12.9KB +117B 6.9KB 6.9KB 0B
core/CodeBlock 60.5KB 60.6KB +120B 10.7KB 10.7KB 0B
core/Collapsible 11.7KB 11.8KB +113B 4.2KB 4.2KB 0B
core/CommandPalette 50.9KB 51.0KB +119B 11.8KB 11.8KB 0B
core/CommandPaletteItem 8.4KB 8.5KB +110B 3.5KB 3.5KB 0B
core/ComplexSelector 55.8KB 55.9KB +147B 10.6KB 10.6KB 0B
core/ContextMenu 77.7KB 77.8KB +101B 14.6KB 14.6KB 0B
core/ContextMenuItem 16.6KB 16.7KB +117B 5.2KB 5.2KB 0B
core/DateInput 99.9KB 100.0KB +102B 14.8KB 14.8KB 0B
core/DateRangeInput 69.4KB 69.5KB +120B 11.2KB 11.2KB 0B
core/DateTimeInput 110.1KB 110.2KB +93B 15.2KB 15.2KB 0B
core/DialogHeader 48.8KB 48.9KB +115B 9.8KB 9.8KB 0B
core/DrawerHeader 48.9KB 49.0KB +113B 11.2KB 11.2KB 0B
core/DropdownMenu 72.7KB 72.8KB +124B 14.7KB 14.7KB 0B
core/DropdownMenuCheckboxItem 16.1KB 16.2KB +106B 5.6KB 5.6KB 0B
core/DropdownMenuItem 15.4KB 15.5KB +101B 5.2KB 5.2KB 0B
core/DropdownMenuRadioItem 16.2KB 16.3KB +110B 5.6KB 5.6KB 0B
core/DropdownMenuSubMenu 58.1KB 58.2KB +113B 9.5KB 9.5KB 0B
core/FileInput 54.1KB 54.2KB +117B 10.3KB 10.3KB 0B
core/IconButton 43.3KB 43.4KB +127B 9.2KB 9.2KB 0B
core/Item 11.4KB 11.5KB +98B 4.7KB 4.7KB 0B
core/LayerProvider 63.3KB 63.4KB +136B 10.1KB 10.1KB 0B
core/Lightbox 51.2KB 51.3KB +111B 9.8KB 9.8KB 0B
core/Link 43.5KB 43.6KB +124B 7.6KB 7.6KB 0B
core/ListItem 53.5KB 53.6KB +119B 10.5KB 10.5KB 0B
core/Markdown 144.5KB 144.5KB +94B 17.4KB 17.4KB 0B
core/MobileNav 51.0KB 51.1KB +113B 10.1KB 10.1KB 0B
core/MobileNavToggle 46.2KB 46.3KB +120B 9.4KB 9.4KB 0B
core/MoreMenu 72.9KB 73.0KB +121B 14.7KB 14.7KB 0B
core/MultiSelector 76.2KB 76.3KB +125B 14.6KB 14.6KB 0B
core/NumberInput 55.7KB 55.8KB +123B 10.7KB 10.7KB 0B
core/Outline 28.6KB 28.7KB +129B 4.0KB 4.0KB 0B
core/Pagination 87.7KB 87.8KB +120B 15.3KB 15.3KB 0B
core/Popover 49.8KB 49.9KB +99B 12.1KB 12.1KB 0B
core/PowerSearch 155.1KB 155.2KB +103B 18.6KB 18.6KB 0B
core/RadioListItem 52.1KB 52.3KB +126B 9.7KB 9.7KB 0B
core/SegmentedControlItem 8.6KB 8.7KB +116B 3.9KB 3.9KB 0B
core/SelectableCard 12.8KB 12.9KB +114B 7.1KB 7.1KB 0B
core/Selector 79.1KB 79.2KB +95B 15.0KB 15.0KB 0B
core/SelectorOption 14.5KB 14.6KB +97B 5.1KB 5.1KB 0B
core/SideNav 58.0KB 58.1KB +112B 10.6KB 10.6KB 0B
core/SideNavCollapseButton 46.6KB 46.7KB +105B 9.5KB 9.5KB 0B
core/SideNavHeading 54.7KB 54.8KB +111B 10.1KB 10.1KB 0B
core/SideNavItem 54.5KB 54.6KB +112B 10.1KB 10.1KB 0B
core/Step 32.4KB 32.6KB +133B 5.3KB 5.3KB 0B
core/Stepper 47.4KB 47.5KB +120B 9.6KB 9.6KB 0B
core/Switch 48.4KB 48.5KB +126B 9.3KB 9.3KB 0B
core/Tab 9.7KB 9.8KB +119B 4.1KB 4.1KB 0B
core/TabMenu 51.6KB 51.7KB +99B 10.0KB 10.0KB 0B
core/Table 84.0KB 84.1KB +85B 15.1KB 15.1KB 0B
core/TableCell 78.8KB 78.9KB +103B 14.8KB 14.8KB 0B
core/TableHeaderCell 78.6KB 78.7KB +105B 14.8KB 14.8KB 0B
core/TableSelectionToolbar 52.4KB 52.5KB +112B 11.2KB 11.2KB 0B
core/TextInput 53.5KB 53.6KB +113B 10.5KB 10.5KB 0B
core/Thumbnail 50.7KB 50.8KB +117B 11.0KB 11.0KB 0B
core/TimeInput 86.8KB 86.9KB +98B 13.8KB 13.8KB 0B
core/Timestamp 27.5KB 27.5KB +16B 9.5KB 9.5KB 0B
core/Toast 59.8KB 60.0KB +120B 9.7KB 9.7KB 0B
core/ToggleButton 44.1KB 44.2KB +104B 9.3KB 9.3KB 0B
core/Token 29.6KB 29.7KB +127B 4.5KB 4.5KB 0B
core/Tokenizer 64.8KB 64.9KB +130B 11.7KB 11.7KB 0B
core/TopNav 51.9KB 52.0KB +119B 10.4KB 10.4KB 0B
core/TopNavHeading 54.2KB 54.3KB +116B 9.9KB 9.9KB 0B
core/TopNavItem 9.0KB 9.2KB +116B 3.8KB 3.8KB 0B
core/TopNavMegaMenu 54.2KB 54.3KB +136B 10.8KB 10.8KB 0B
core/TopNavMegaMenuItem 9.1KB 9.2KB +119B 4.1KB 4.1KB 0B
core/TopNavMenu 53.6KB 53.7KB +112B 10.1KB 10.1KB 0B
core/TreeList 32.5KB 32.7KB +128B 4.7KB 4.7KB 0B
core/Typeahead 61.5KB 61.6KB +116B 11.3KB 11.3KB 0B
lab/SearchField N/A 56.3KB N/A N/A 1.5KB N/A

Sizes are gzip. Import counts the JavaScript the import loads eagerly; CSS counts the package stylesheet rules referenced by the modules it can load from its own package, lazily loaded ones included.

Bundle Size Summary

Gzip figures measure each package's entry file, not the code an import pulls in.

Package Entry (ESM) Entry gzip before Entry gzip after Delta
@astryxdesign/core 4.9KB 1.2KB 1.2KB 0B
@astryxdesign/lab 4.9KB 1.9KB 2.0KB +114B
Package stylesheet Gzip before Gzip after Delta
@astryxdesign/core 34.6KB 34.6KB 0B
@astryxdesign/lab 11.1KB 11.9KB +827B

Accessibility Audit

Status: No accessibility violations detected.

Visual Regression

55 of 502 shot(s) changed.

A change here is a question, not a failure: check whether the after is the
picture you intended. Record that review on the PR. Baseline maintenance is an
explicit dispatch of CI; this report never rewrites the baseline or adds a release gate.

component story theme mode pixels
Selector Indicator Space Bottom Sheet Narrow End RTL neutral light 753,933
Selector Indicator Space Bottom Sheet Wide Start neutral light 740,072
RichTextEditor Markdown parity: side by side probe dark 558,840
RichTextEditor Markdown parity: side by side probe light 540,756
Chat Full AI Chat probe light 230,823
Chat Full AI Chat probe dark 229,805
AppShell With Mobile Nav probe light 217,010
AppShell With Mobile Nav probe dark 216,960
Collapsible Dividers probe dark 66,445
Collapsible Dividers probe light 66,445
AppShell Playground neutral dark 65,198
AppShell Playground neutral light 63,788
Chat Default neutral dark 36,304
Chat Default neutral light 35,767
Chat Empty State probe light 23,531
Chat Empty State probe dark 22,622
ChatAutoScroll Scroll Behavior Comparison neutral dark 15,378
ChatAutoScroll Scroll Behavior Comparison neutral light 14,107
Chat With Attachments probe light 13,406
Chat With Attachments probe dark 11,232

and 35 more.


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This needs an engineering owner's decision before it can be approved, and the branch needs to shrink to its own change. No current spec governs SearchField's new placement="tab" or SearchFieldHandle.cancel(), and the draft spec:AST-094 on this branch never mentions them while amending current claims (spec:AST-025 FR14, design:user-states DR1 and DR3) and adding new requirements. An engineering owner needs to identify or provide the governing spec for the tab placement and cancel(), update those existing claims or reject the amendments, and record the decision by commenting /approve-spec <full head SHA> on this pull request; the author may do so if they are an engineering owner. Whatever that decision is, these changes are still needed:

  • Land or rebase past the predecessor PRs so this diff is the 285-line tab-placement commit rather than 32,035 authored lines across 173 files.
  • Fix spec:AST-094 FR7's citation of spec:AST-090, which is not in the repository.
  • Add a browser proof that a tap in the tab placement focuses the field without Safari scrolling the page.

[Automated review]

follows.
- **FR7 — Exits animate as UIKit's do.** A touch presentation MUST play the
exit its UIKit counterpart plays. **Proposed; pending owner review:** this
departs from the draft `spec:AST-090` FR1 (exits off by default) and FR10

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

spec:AST-090 is not in the repository at this head or on main (it is proposed in #8003), so this departure has no text an owner can check it against. Consider stating the exit and Reduce Motion rule on its own here, or adding the citation once AST-090 lands.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This record is #8076's (spec:AST-094, the foundation under this stack); the AST-090 citation is its owner's to settle. Nothing in this PR's own diff touches it.

// Types
// =============================================================================

/** What `handleRef` exposes: focus and blur the field's input. */

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This comment, and the handleRef prop's comment at line 177, still describe the handle as focus and blur only. Mentioning cancel() would keep IDE hovers in line with SearchField.doc.mjs.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in dafec0d: SearchFieldHandle's comment reads "focus, blur and cancel the field", the cancel() member has its own doc, and the handleRef prop's comment reads "Focus, blur and cancel, for a host that activates the field from its own tap or draws its own cancel button", matching SearchField.doc.mjs.

Comment on lines +267 to +268
* tab bar gives it; the tab bar's own cancel button calls `cancel()`. TabBar's
* search story shows the real thing.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No TabBar search story exists in the repository yet (it arrives with #8192), so this pointer leads nowhere for now. Consider rewording until that story lands.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Resolved at dafec0d: the InTabBar story's comment no longer points to a TabBar story; it describes its stand-in bar and the handle's cancel().

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This needs an engineering owner's decision before it can be approved, and the branch needs to shrink to its own change. No current spec governs SearchField's placement="tab" or SearchFieldHandle.cancel(), and the draft spec:AST-094 on this branch never mentions them while adding FR1–FR23 and proposing amendments to current records (spec:AST-025 FR14, design:user-states DR1 and DR3); an engineering owner needs to identify or provide the governing spec for the tab placement and cancel(), approve or reject those draft requirements, and record the decision by commenting /approve-spec <full head SHA> on this pull request, which the author may do if they are an engineering owner. Whatever that decision is, these changes are still needed:

  • Land or rebase past the predecessor PRs so this diff is the 285-line tab-placement commit rather than 32,161 authored lines across 173 files.
  • Fix spec:AST-094 FR7's citation of spec:AST-090, which is not in the repository.
  • Keep the caret under the finger when SearchField or ChatLayout claims a tap on a text control; today the refocus leaves it at the start of an existing query or draft, or at its last position.

[Automated review]


/** Focuses without Safari's reveal and puts the caret under the finger. */
function focusAtPoint(editable: HTMLElement, x: number, y: number) {
editable.focus({preventScroll: true});

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

For a textarea or input composer this claimed tap never places the caret: the gesture host cancels the tap's touchend, and the selection below is set only for contenteditable. In Chromium with touch emulation, focus({preventScroll: true}) leaves the caret at offset 0 of a never-focused draft, or at its last position, where a native tap put it under the finger, so tapping into a draft to change a word lands elsewhere, despite "puts the caret where the finger lifted" above. Consider setting the selection from the tap point for text controls too, or leaving taps on a non-empty text control to the browser, with a browser test that taps mid-text.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not in this PR at this head (dafec0d): the stack is now #8181 → #8216 → this PR, and useChatKeyboard.ts left it with the keyboard guide PR.

}),
tap => {
if (tap.state === 'ended') {
inputRef.current?.focus({preventScroll: true});

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The same caret loss happens here, now for tab as well as bottom: the claimed tap cancels the browser's own focus, and this refocus leaves the caret where script focus puts it (the start, or the last caret position, in Chromium) rather than where the finger lifted in an existing query.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in e4f2ea4 (#8216, under this PR): the claimed tap puts the caret where the finger lifted (caretOffsetAt from the tap's location, then setSelectionRange). The bottom interaction spec's "a tap into an existing query puts the caret where the finger lifted" covers it in Chromium and WebKit, and the tab placement takes the same path.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This needs an engineering owner's decision before it can be approved, and the branch needs to shrink to its own change. No current spec governs SearchField's placement="tab" or SearchFieldHandle.cancel(), and the draft spec:AST-094 on this branch never mentions them while adding FR1–FR23 and proposing amendments to current records; an engineering owner needs to identify or provide the governing spec for the tab placement and cancel(), approve or reject those draft requirements, and record the decision by commenting /approve-spec <full head SHA> on this pull request, which the author may do if they are an engineering owner. Whatever that decision is, these changes are still needed:

  • Land or rebase past the predecessor PRs so this diff is the 309-line tab-placement commit rather than 36,898 authored lines across 199 files.
  • Take the theme's platform adaptation condition and --motion-<role> tokens out of this stack, or have their owners amend spec:AST-012 FR2, architecture:theme-tokens INV1 and spec:AST-094 FR4 and DEC-1 first, since the code contradicts them.
  • Keep the caret under the finger when SearchField or ChatLayout claims a tap on a text control, and pass preventScroll on the clear button's refocus in tab and bottom.
  • Fix spec:AST-094 FR7's citation of spec:AST-090, which is not in the repository.

[Automated review]

// keyboard rises, as UIKit's clear button makes its field first responder.
const handleClear = useCallback(() => {
setValue('');
inputRef.current?.focus();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

In tab and bottom this is the one refocus left without {preventScroll: true}: the clear button stays visible while the field is active but not editing, and its taps are left to the browser, so tapping it after a tap outside lets Safari reveal the field, the page pan these placements avoid (see the handle comment at line 149). Consider passing {preventScroll: true} here when isBottom || isTab.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in e4f2ea4 (#8216, under this PR): the clear button refocuses with {preventScroll: true} in the bottom and tab placements (the field's focusOptions), as do the claimed tap and the handle's focus(). The jsdom case "the clear button refocuses the field without the browser scrolling it into view" and the interaction case "the clear button refocuses the field without Safari's reveal" cover it.

* is everything else. Pair `ios` with `pointer: 'coarse'` for a touch
* profile, such as touch motion tuned per platform.
*/
platform?: 'ios' | 'other';

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Current spec:AST-012 FR2 keeps the when vocabulary closed (width, pointer, contrast, motion; "Future environment fields require explicit additions to this closed vocabulary"), and the theme authoring contract says an adaptation change preserves it. platform needs that amendment from the record's owners first, or it should leave this stack with the rest of the motion-role work.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Resolved upstream: at this head (on #8076 b496085) themeAdaptations.ts has no platform field.

if (scale) {
Object.assign(tokens, expandMotionScale(scale));
}
Object.assign(tokens, expandMotionRoles(input.motion, 'motion'));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This writes --motion-<role> into the theme's portable tokens (as expandMotionRoles.test.ts asserts), names and defaults that originate in the motion tables rather than tokens.stylex.ts, which current architecture:theme-tokens INV1 requires. It also contradicts this stack's own spec:AST-094 FR4 ("A touch presentation MUST read its motion from the table on every theme") and DEC-1.

@vjeux vjeux Oct 25, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This writer is #8076's (the foundation under this stack). spec:AST-094, now current through #8378, makes touch motion themeable (FR4, DEC-3); the architecture:theme-tokens INV1 question stays with #8076. Nothing in this PR's own diff touches it.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This needs an engineering owner's decision before it can be approved, and the branch needs fixes whatever that decision is. No current spec on main governs SearchField's placement="tab", SearchFieldHandle.cancel(), the tab field's focus without Safari's scroll-into-view, or the isRtlElement export from @astryxdesign/core/hooks (spec:AST-094 and spec:AST-099 are still open pull requests), so an engineering owner needs to identify or provide the governing spec for them and record the decision by commenting /approve-spec <full head SHA> on this pull request, which the author may do if they are an engineering owner. These changes are still needed:

  • Make Lab's SearchField import only what Core publishes: @astryxdesign/core/motion/uikit, /motion/animator, /motion/useAnimator, /gestures and /utils/touchPresentation are not in Core's exports, which is why build-sandbox fails.
  • Land or rebase past the predecessor pull requests so this diff is the 483-line tab-placement commit rather than 36,785 authored lines.
  • Take the defineTheme motion roles out of this stack, or have architecture:theme-tokens INV1 amended first, since the --motion-<role> variables are token names tokens.stylex.ts does not declare.

[Automated review]

type MotionCurve,
type MotionHandle,
} from '@astryxdesign/core/motion/animator';
import {registerSearchTable, search} from '@astryxdesign/core/motion/uikit';

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Core's exports map has no ./motion/uikit (nor ./motion/animator, ./motion/useAnimator, ./gestures or ./utils/touchPresentation), so this import only resolves through the workspace aliases: CI's build-sandbox stops here with "./motion/uikit" is not exported … from package @astryxdesign/core, and any app bundling Lab's SearchField would too. Publish the subpaths Lab needs from Core (as experimental subpaths) or stop importing unpublished Core modules.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Waits on an engineering owner's decision on #8076: which route Lab touch components take (into core, one marked public entry, or contained Lab subpaths that the registry leaves out). SearchField's imports follow the route chosen.

}
const variable = motionRoleVariable(id);
try {
tokens[variable] = formatMotionRoleValue(kind, value);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This writes --motion-<role> names taken from the motion tables into the theme's tokens. architecture:theme-tokens INV1 says a core token name and its default originate in tokens.stylex.ts and projections do not introduce names, so the roles need to leave this stack or INV1 needs amending first.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

spec:AST-094, current on main through #8378, adds the touch motion roles to architecture:theme-tokens beside the duration and easing tokens (FR4, DEC-3). The writer itself is #8076's; nothing in this PR's own diff touches it.

vjeux added 15 commits October 29, 2026 10:18
…er and for the two stops the input stream fixes

- A still finger with sub-pixel jitter over a scroll view keeps its tap
  and scrolls nothing (spec:AST-094 FR18–FR22).
- A tap is still recognized under an app's window-capture
  stopPropagation, and under a document-capture
  stopImmediatePropagation registered before core's: the recognizers hear
  touches on the window's capture phase.
Chromium and WebKit pass.
…s once

Where nothing that claims is attached, the host's touchend listener is
passive and cannot cancel the engine's own click after a retargeted tap
clicks what is drawn. The shared click guard swallows that late click
whatever is attached; this case pins it, as asked on meta#8293.
Takes meta#8360's head, which removes a document's or shadow root's
touch-action rules with its last marked element and names the build
changeset's treeshakeCompensation default, in place of 1e1431f.
…esture host's subscriptions

The gesture host subscribes no click: the one cancelling click subscriber
is the click guard's, added at a window's first arm and kept. The release
note, the stream's header and the gestures README listed click with the
host's touchend and contextmenu; they now name the guard's own.
…task ended at once, however late the first read

WebKit under load from other tasks: the call's task ends at once, another
task holds the main thread, and the browser commits the animation after
it, dated at the call. Nothing in the call's task delayed it, but the
first read still moved its start to the read, about 95 ms late on a
loaded box, so whatever chains on its end (the second half of a Reduce
Motion cross-fade, a cancel fading on the previous fade's end) ran that
much late and the cross-fade missed design:reduced-motion DR2's 200 ms.
Fails now: the start moves to 1100.
e7b0676 moved a call's start from rest to its first read whenever
WebKit had dated it more than two frames before that read. Under load
from other tasks the first read comes late with nothing in the call's
task delaying it, so the start moved about 95 ms on a loaded box, and
whatever chained on the call's end ran that late: the second half of a
Reduce Motion cross-fade, so SearchField's cancel missed DR2's 200 ms.
The call's task now records when it ended, at its first microtask (or a
read in those microtasks is that time), and only a call whose own task
ran past the call by more than two frames, the block e7b0676 fixed,
moves its start; a read other tasks delay keeps the browser's start.
…s its start past the block

Core Animation dates an animation at the commit, when the calling task
ends, however short the block before it. A 20 ms block in the call's task,
with WebKit's start dated at the call, left the start at the call: the
two-frame bound skipped it. Fails now.
… task, with no threshold

Core Animation dates an animation at the commit, when the calling task
ends, whatever the block's length. The call's task already records when
it ended, at its first microtask, so a start the browser dated before that
(WebKit's last frame time before the task) now moves to it: a task that
ended at once leaves the start at the call, a blocked one moves it past
the block, however short, and a read other tasks delay changes nothing.
The two-frame bound, which told a read's own frame from a block before the
task's end was known, goes, and the start no longer moves to the read.
…'s click guard has taken the click

The claimed tap swallows its own late mouse events until their click. With
meta#8360, the gesture host arms its click guard at the claimed lift, and the
guard takes that click first, on the window's capture phase, so the
swallow never saw it and stayed armed: the next press's mousedown, mouseup
and click never reached the page. The swallow now notes the guard while
it is armed and lets go once the guard has (its click, the next press, or
its window); with no guard it ends at the click, as before.
`internal/touch` re-exports `isClickGuardArmed` by name.

Red-first: "a claimed tap swallows its own late mouse events, until the
next touch" fails on the previous head (the second press's events are
swallowed) and passes in Chromium and WebKit with this change.
@vjeux
vjeux marked this pull request as draft October 29, 2026 22:34
vjeux added 8 commits October 29, 2026 16:10
…few ms, and one task's calls start together

Browser start times are frame times, while a task's end is a live clock,
so on every call they differ by up to a frame plus the task's own length.
Moving every start from rest to its task's end shifted each one by that
length, about 5 ms in a component's effect after a tap, and the shift
added up along a chained sequence: SearchField's Reduce Motion cancel
measured 204-207 ms against design:reduced-motion DR2's 200. The first
case fails now (the start moves to 1010). The second keeps one motion's
parts together when they are separate calls in one task: a block
measured per call would split them by a frame.
…n on more than two frames, and all the task's calls move together

fc42d64 moved every start from rest to the end of the call's task.
Browser start times are frame times while that end is a live clock, so on
every call they differ by up to a frame plus the task's own length: each
start slid by that length, and a chained sequence added it up, about
5 ms per link in SearchField. The rule from e6876ca is back, with its
bound now named for that quantization: only a task that ran on more than
LATE_START_MS (two frames) past its first call blocked anything, and its
calls' starts move to their first read. The block is now measured per
task, not per call, and every call of a blocked task takes the same read,
so one motion's parts that are separate calls in one task (a component's
effect) start together instead of splitting by a frame. The 20 ms case
keeps the browser's start, as no clock here tells it from quantization.
…art moves only past a real block) into meta#8181 [skip ci]
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 30, 2026
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 30, 2026
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 30, 2026
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 30, 2026

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Approval waits on an engineering owner's decision: no current spec governs SearchField's placement="tab" or SearchFieldHandle.cancel(), so an engineering owner needs to approve or reject both and identify the record that states them, recording the decision by commenting /approve-spec <full head SHA> on this pull request (the author may do so as an engineering owner). Whatever that decision, these changes are still needed:

  • Shrink the branch to its own six-file change by landing or retargeting onto its predecessors (#8076, #8340, #8360, #8180, #8181, #8216); it carries 35,115 authored lines today.
  • Drop the layout effect that only copies cancel into a ref (SearchField.tsx:588-590) by building the handle with cancel in its dependencies (architecture:react-component-runtime INV3).
  • Make the tab tap's no-pan promise provable: SearchFieldTab.interaction.browser.spec.ts:111 passes with the tap claim off, so spy on the input's focus calls as the bottom spec does, and add Chrome on Android evidence for the tab tap that SearchField.doc.mjs says never scrolls the page.
  • In the predecessors, the Lab keyboard listener's overlaysContent write and geometry-report height contradict spec:AST-099 FR8 and DEC-4 (the InTabBar stand-in repeats that rule), and the gesture host's coarse-pointer-only install contradicts architecture:react-component-runtime INV13.

[Automated review]

Comment on lines +588 to +590
useLayoutEffect(() => {
cancelRef.current = cancel;
}, [cancel]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This layout effect only copies cancel into a ref, so it names no external system, which architecture:react-component-runtime INV3 requires of a new Effect ("A new or changed Effect MUST name the external system it synchronizes."). Defining cancel before useImperativeHandle and listing it in the handle's dependencies gives the handle the latest cancel without the ref or the effect.

await (await touchDriver(page)).tap(await centerOf(field));
await expect(field).toBeFocused();
// No page move: the tap focuses without Safari's reveal.
expect(await page.evaluate(() => window.scrollY)).toBe(0);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This passes with the tap claim off: on the InTabBar story in Chromium an unclaimed tap (the VirtualKeyboard API left in place) and a plain focus() both leave scrollY at 0 with a 32 px scroll range, and it runs before keyboard(page, COVER) raises the emulated keyboard. A spy on the input's focus calls expecting [{preventScroll: true}], as the bottom spec's "a tap focuses the field without Safari's reveal" does, would prove spec:AST-099 FR4's tap route for the tab placement.

Comment on lines +139 to +145
const hold = () => {
if (appOverlay == null) {
appOverlay = keyboard.overlaysContent;
keyboard.overlaysContent = true;
}
commit(keyboard.boundingRect.height);
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

In Chrome on Android this switches the page's overlaysContent on and takes boundingRect.height as the keyboard height, while spec:AST-099 FR8 and DEC-4 take the height from FR2's visual-viewport measurement there too and say Astryx never overrides the app's own viewport setting.

Comment on lines +14 to +21
* - Recognizers attach, and the host registers listeners, only while the
* primary pointer is coarse (`spec:AST-094` FR19, FR24; coarsePointer.ts).
* Where it is fine, an attach is recorded but nothing is installed: no
* document, window or element listener, no `touch-action` or other style,
* nothing delivered, so a finger on a touchscreen laptop gets the
* browser's defaults. The host follows the query: turning coarse installs
* it and styles every registration; turning fine cancels every touch in
* flight and removes it all. A development warning names the first attach

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

CURRENT architecture:react-component-runtime INV13 says "The gesture host attaches for every pointer, with no touch-only query", and spec:AST-094 FR43 says gestures attach for a mouse, a pen and a finger, not only a coarse primary pointer; this host installs nothing while the primary pointer is fine.

This branch was successfully deployed

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

Labels

CLA Signed This label is managed by the Meta Open Source bot. needs:design-review Affects visuals — Design should review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants