Skip to content

fix(core): audit BaseTypeahead - #6179

Merged
cixzhang merged 6 commits into
mainfrom
night-watch-component-audit/BaseTypeahead/2026-09-09
Sep 10, 2026
Merged

cixzhang merged 6 commits into
mainfrom
night-watch-component-audit/BaseTypeahead/2026-09-09

Conversation

@cixzhang

@cixzhang cixzhang commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Why

core/BaseTypeahead was first in the Night Watch queue. The audit found dropped input props, invalid empty-result semantics, grapheme-counting drift, and narrow-viewport overflow. Formal review then found incomplete native/legacy precedence, remaining 320px content overflow, an omitted stale post-Escape failure, and excess permanent fixtures.

What changed

  • forwards supported DOM, ARIA, data, event, class, style, and xstyle inputs; defined legacy input aliases win, while native id, aria-labelledby, aria-describedby, and tabIndex survive when aliases are undefined;
  • renders completed empty search as a disabled option, counts grapheme clusters, and keeps the popup plus long option content inside viewport gutters;
  • documents menuWidth as a requested width before viewport clamping and records the shipped focusable-disabled and stale post-Escape failures without overstating them;
  • reduces Storybook to reusable, materially distinct fixtures; promotes the existing Custom Search implementation to the hero and keeps one distinct custom-results example;
  • adds the observational draft, focused tests, docs, changeset, forced-colors treatment, and curated RTL coverage.

No public prop, export, default, or compatibility promise is added or removed.

Audit result

BaseTypeahead exact-head state matrix

Affected rubric rows

  • A4: the inherited pending-result-after-Escape defect is now explicitly reproduced, retained, and scored; Accessibility remains 2.0.
  • A11: focusable-disabled Enter selection remains a retained BLOCK; docs/spec/evidence now describe shipped behavior accurately.
  • P2/P3: native/alias precedence is fixed and tested; API improves 2.5 → 3.0.
  • R1: at 320px, the listbox changes from x=32, right=320, clientWidth=288, scrollWidth=447 to x=32, right=304, clientWidth=272, scrollWidth=272; every option is also contained. Responsive improves 1.0 → 5.0.
  • X10–X12: selected state is driven from Default, redundant Selected Result / Consumer Props stories and exhaustive argTypes are removed, and block examples are distinct rather than duplicate.

Retained findings

  • BLOCK — A1: direct BaseTypeahead remains constructible without an accessible name; requiring one changes public API/default behavior.
  • BLOCK — A4: a pending result can reopen the popup after Escape. Exact-head retained-red proof.
  • BLOCK — A11: an open combobox that becomes focusable-disabled still selects on Enter. Exact-head retained-red proof. #5999 and #6000 already own the source fix.
  • BLOCK — P-INV12: released BaseTypeaheadProps exposes package-internal composition knobs; removal or admission needs compatibility ownership.
  • FIX: result-row, group-heading, and selected-state theming reachability needs a public target decision.
  • Manual design question: bare-input focus-ring ownership remains unsettled between BaseTypeahead and its direct caller wrapper.

Validation

  • Final-head knowledge, core type/docs, docsite generation/tests, and focused suites: pass at dc02cb0; focused suite 610 passed.
  • Storybook build, strict lint, component axe, RTL, and Chromium receipts remain bound to 95d05ca; the only later source delta is the two focusable-disabled accuracy comments.
  • Docsite: 495 passed. Component axe: 0 violations across 8 retained stories. Curated RTL: D4 pass, 1 measured, 0 gaps.
  • Chromium: 26 standard frames + 1 forced-colors frame, all sensor-green; representative contrast 7/7 pass.
  • Exact 320px geometry: 16px end gutter, no document/listbox/option horizontal overflow.
  • Local monorepo pnpm test on predecessor candidate af0df71f (the only later change is block registry composition): 16,112 passed, 33 failed, 45 skipped. Failures were unrelated Mac/repository fixtures and timing limits; exact-head GitHub CI is the authoritative full-suite gate.

Exact-head audit eligibility report

{
  "report_version": 2,
  "component": "BaseTypeahead",
  "package": "core",
  "mode": "N",
  "rubric_version": "1.16.2",
  "repository_head": "dc02cb01275f4b616a08533295db7c2a2b6fc814",
  "landed_commit": "18781904cb07904c51f273aaaed272ec62d669b1",
  "landed_bytes": {"pr_owned_files": 12, "match_reviewed_head": true},
  "evidence_head": "d39ed3262601f1292890841cf7158e25bc89133c",
  "score": {
    "review_baseline": {"value": 72.4, "grade": "C"},
    "corrected": {"value": 77.8, "grade": "C"}
  },
  "inventory": {
    "closed": true,
    "evidence": "https://github.com/facebook/astryx/blob/d39ed3262601f1292890841cf7158e25bc89133c/pr-6179/BaseTypeahead/README.md"
  },
  "unresolved": {
    "blocks": ["A1", "A4", "A11", "P-INV12"],
    "fixes": ["T7-reachability", "C22-state-machine-boundary"],
    "manual_gaps": [
      "required accessible-name API/default",
      "released internal-prop compatibility",
      "bare-input focus-ring ownership",
      "reconciliation with PRs 5999 and 6000"
    ]
  },
  "required_checks": {
    "head": "dc02cb01275f4b616a08533295db7c2a2b6fc814",
    "state": "passed"
  },
  "eligibility": {
    "verdict": "landed_human_reviewed",
    "auto_merge": false,
    "reasons": [
      "unattended merge remained ineligible because four BLOCKs remain",
      "AST-029 FR11 unattended audit activation is not shipped",
      "independent exact-head review and required checks passed before normal merge"
    ]
  },
  "ledger_updated": true,
  "ledger_commit": "9b8be1bb1d8cd314c99a5f962456fafdb2d375dc"
}

This PR landed through normal human-reviewed merge; auto-merge was not used. The final ledger row records only the landed squash commit under rubric 1.16.2.

@vercel

vercel Bot commented Sep 9, 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 Sep 10, 2026 4:57pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Sep 9, 2026
@github-actions github-actions Bot added the needs:design-review Affects visuals — Design should review label Sep 9, 2026
@cixzhang
cixzhang force-pushed the night-watch-component-audit/BaseTypeahead/2026-09-09 branch 4 times, most recently from 7fee5ae to 95a475b Compare September 9, 2026 11:17
@cixzhang
cixzhang force-pushed the night-watch-component-audit/BaseTypeahead/2026-09-09 branch from 95a475b to 3930cd1 Compare September 9, 2026 11:24
github-actions Bot added a commit that referenced this pull request Sep 9, 2026
@github-actions

github-actions Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

🧪 Sandbox Preview

View Sandbox for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

Modified Components

Typeahead (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 1395 -
Complexity N/A Very High (188) -

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/core N/A 4.8KB 1.2KB

Accessibility Audit

Status: No accessibility violations detected.

Visual Regression

Status: No visual change across 2 compared shot(s).


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

@cixzhang
cixzhang force-pushed the night-watch-component-audit/BaseTypeahead/2026-09-09 branch from 3930cd1 to 8c792c2 Compare September 9, 2026 12:01
@cixzhang
cixzhang force-pushed the night-watch-component-audit/BaseTypeahead/2026-09-09 branch from 8c792c2 to 7595c9e Compare September 9, 2026 12:14
@cixzhang
cixzhang force-pushed the night-watch-component-audit/BaseTypeahead/2026-09-09 branch from 7595c9e to d539b93 Compare September 9, 2026 12:32
github-actions Bot added a commit that referenced this pull request Sep 9, 2026
github-actions Bot added a commit that referenced this pull request Sep 9, 2026
github-actions Bot added a commit that referenced this pull request Sep 9, 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.

Direct BaseTypeahead users can still lose accessible relationships, focus order, or result text, so I don’t think this is ready yet.

  • The new passthrough still overwrites id, tabIndex, aria-describedby, and aria-labelledby.
  • At 320px, the popup reaches one viewport edge and the long result creates 447px of scrollable content inside a 288px listbox.
  • The observational record says disabled and stale paths are covered, but exact-head probes still select after becoming focusable-disabled and reopen after Escape when pending work resolves. These are inherited, so please record them rather than taking on their fixes here.
  • Please keep the permanent fixture surface smaller: reuse the existing Custom Search block and drive equivalent story states from one reusable fixture.

The grapheme, empty-option, forced-colors, label/focus, a11y, and RTL checks otherwise look good.

@cixzhang
cixzhang force-pushed the night-watch-component-audit/BaseTypeahead/2026-09-09 branch 2 times, most recently from af0df71 to d08602b Compare September 10, 2026 16:05
@cixzhang
cixzhang force-pushed the night-watch-component-audit/BaseTypeahead/2026-09-09 branch from d08602b to 7af883c Compare September 10, 2026 16:17
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec dc02cb0

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

The final head resolves the prior review findings. Native input attributes preserve their documented precedence, the 320px results surface keeps both gutters and contains long content, inherited A4 and A11 violations are recorded accurately, and the permanent fixtures are reduced to reusable coverage. Exact-head evidence and the completed machine checks support the corrected 77.8/C audit result.

@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec dc02cb0

@cixzhang
cixzhang merged commit 1878190 into main Sep 10, 2026
29 of 30 checks passed
github-actions Bot added a commit that referenced this pull request Sep 10, 2026
@github-actions
github-actions Bot deleted the night-watch-component-audit/BaseTypeahead/2026-09-09 branch September 11, 2026 06:22
AKnassa added a commit to AKnassa/astryx that referenced this pull request Sep 26, 2026
Resolved conflicts:
- packages/core/src/Tokenizer/Tokenizer.tsx: took upstream's
  BusyIndicatorLaneProvider-wrapped BaseTypeahead (array inputXStyle with
  the lane reserve) and re-added
  `transformQuery={hasCreate ? commitDelimitedText : undefined}`.
- packages/core/src/Tokenizer/Tokenizer.test.tsx: took upstream's
  multi-line vitest import (adds beforeEach) and folded this branch's
  `useState` into upstream's `import {Profiler} from 'react'`.
- packages/core/src/Typeahead/BaseTypeahead.doc.mjs: kept upstream's
  xstyle/inputTabIndex/onKeyDown entries and re-added the transformQuery
  entries (docs, docsZh, docsDense), prettier-formatted like the rest of
  upstream's now-formatted file.

Semantic fallout fixed in packages/core/src/Typeahead/BaseTypeahead.tsx:
- The empty-query branch called `setIsLoading(false)` directly. Upstream
  (meta#5555) routes the busy state through `setLoading`, which also reports
  it to the BusyIndicatorLane and edge-guards on a ref. Bypassing it left
  Tokenizer's end-lane spinner up forever after a delimiter commit
  abandoned an in-flight search. Now `setLoading(false)`. Covered by the
  new Tokenizer test "a delimiter commit clears the busy indicator of an
  in-flight search" (red before: the Loading status span was still in
  the document).
- Upstream's meta#6179 audit spreads `...rest` onto the input, but this
  branch's hard-coded `onCompositionEnd={handleCompositionEnd}` came
  after it and silently dropped a consumer's onCompositionEnd. It is now
  destructured and composed with composeEventHandlers, like
  onFocus/onBlur/onPointerDown. Covered by extending BaseTypeahead's
  "forwards supported DOM, styling, and event props" test (red before:
  onCompositionEnd called 0 times).

Tokenizer, Typeahead and PowerSearch suites: 14 files, 439 tests pass.

This branch was successfully deployed

1 active deployment
Preview — dc02cb01 Deployed Sep 10, 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.

1 participant