Skip to content

[Component Audit] ChatComposerInput: keep inserted text and dropped files usable - #6419

Merged
cixzhang merged 1 commit into
mainfrom
night-watch-component-audit/ChatComposerInput/2026-09-21
Sep 21, 2026
Merged

cixzhang merged 1 commit into
mainfrom
night-watch-component-audit/ChatComposerInput/2026-09-21

Conversation

@cixzhang

@cixzhang cixzhang commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

User impact

This audit keeps dictated or otherwise programmatically inserted text synchronized with the composer, delivers dropped files through the documented attachment callback, and lets product paste handlers intercept long text before automatic token conversion.

No public prop, type, export, default, token format, submission rule, or visual design changes.

Audit identity

  • Package: @astryxdesign/core/Chat
  • Base: 20777236fb41228ea370c3af52c11167ea1433f3
  • Head: c3ee01559f7e17eab2e12cc05798c842792e489d
  • Rubric: Night Watch 1.16.6
  • Mode: manual guarded merge after exact-head gates and independent private review

Scorecard

Baseline: 76.0/100 (C), 3 BLOCKs, §5b/§9/§10 not measured
After local remediation: 85.8/100 (B), 0 BLOCKs, §5b/§9/§10 not measured
Projected after complete exact-head rendered evidence: 87.3/100 (B), 0 BLOCKs

Section Weight Before After State / evidence
§1 Accessibility 16 4.5 4.5 Named textbox/combobox semantics, disabled state, IME handling, and composer-owned keyboard focus ring remain intact.
§2 Theming 14 4 4 Existing root target and semantic color, spacing, and type tokens are unchanged.
§3 Public API 14 4 4 Props, callbacks, defaults, exports, ref, BaseProps, and token serialization are unchanged.
§4 Behavior 12 2 4.5 Imperative edits emit once, consumer paste gets first refusal, and file drops reach onFiles.
§5a Objective design 6 4.5 4.5 Logical layout, tokenized paint, bounded overflow, and the iOS input-size floor remain intact.
§5b Rendered design 4 — — Pending exact-head browser pixels; no local visual claim is inferred.
§6 Testing 8 4 4.5 Three red-before-green regressions plus exact single-emission coverage; 81 focused tests pass.
§7 Code health 8 4 4 Raw insertion and observable change ownership are explicit; existing selection, portal, and async ownership remains unchanged.
§8 Docs/Storybook 8 3.5 4.5 Paste behavior, anatomy, ownership, and direct browser fixtures now match shipped behavior.
§9 i18n/RTL 5 — 5 Catalog-backed copy, logical CSS, and exact verified-N/A receipts; exact-head RTL result pending.
§10 Responsive/touch 5 — 4.5 Max-row overflow and the iOS 16px floor are preserved; exact-head browser result pending.

Objective fixes

  • handleRef.insertText() now uses the same observable change pipeline as typing, so composed features such as dictation update the serialized draft and clear the placeholder.
  • String trigger results use a raw insertion primitive and still emit exactly once; consumer-handled paste also avoids duplicate onChange calls.
  • File drag-over/drop prevents native page navigation, preserves file order, invokes onFiles once, and remains inert while disabled.
  • The public docs now include pasteAsToken, callback precedence, file-drop guidance, anatomy, and the complete imperative handle.
  • A draft observational component contract records shipped ownership and verification without adding policy or changing API.

Red → green evidence

Finding Before After
Imperative insertion Text changed only in the DOM; composer state and placeholder stayed stale. One insertion emits one effective value and clears empty state.
File drop Dropped files followed native browser behavior and never reached onFiles. The editor prevents the default and delivers the ordered files once.
Paste precedence Default long-paste token conversion bypassed the documented consumer callback. onPaste receives first refusal; built-in token/plain insertion runs only when unhandled.
Duplicate-emission review finding The first repair caused trigger and handled-paste paths to emit twice. Raw insertion plus an emission-generation guard preserve exactly one notification on every path.

Local verification

  • Focused ChatComposerInput suite — 81 passed, including preserved red-before-green evidence.
  • Core source/docs and Storybook typechecks — passed.
  • Strict lint and repository/knowledge checks — passed.
  • Full package build and production Storybook build — passed.
  • Independent private review — clean at the exact candidate commit after one repair round.

Needs Review

No new product decision is required. File validation/upload UX, trigger result content, custom token semantics, and visual representation remain owned by their existing product or component layers.

Exact-head gates

Exact-head CI, Storybook plays, accessibility, RTL, rendered evidence, visual acceptance, spec-owner reconciliation, and the independent private review all passed. The owner-exempt review-required status was emitted by GitHub Actions App 15368.

Final result

  • Merged: a3f81843b26bfadc27d486b13602598f11745461
  • Final score: 87.3/100 (B), 0 BLOCKs
  • Ledger: a7d96a16dbb9626ec765c2bdcfbcdff461b1da81

@vercel

vercel Bot commented Sep 21, 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 21, 2026 12:41pm UTC

Request Review

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

astracat-bot Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟡 Reviewed (for maintainers only) Sep 21, 2026, 12:48 PM UTC

@github-actions

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.

No new or modified components detected.

Bundle Size Summary

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

Accessibility Audit

Status: 36 accessibility violation(s) found — 2 critical, 34 serious.

Button pattern - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/18 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
ChatComposer - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/19 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
ChatComposerInput - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/16 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
ChatReasoning - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 4/5 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
ChatToolCalls - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 10/11 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
Checkbox pattern - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 2/33 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
CheckboxList - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 4/17 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
ClickableCard - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/5 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
CodeEditor - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 3/7 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
CodeEditorPerf - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 2/2 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
CodeEditorTheme - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 13/14 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
CodeTheme - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 14/16 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
DateRangeInput - 1 issue(s)
  • 🔴 critical: Ensure an element's role supports its ARIA attributes
    • Rule: aria-allowed-attr · Affects 1/21 stories · Learn more
    • WCAG: 4.1.2 (Level A)
FileInput - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 3/15 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
GridMasonry - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/3 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
Heading - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/16 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
Icon - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/18 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
LogStream - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 2/3 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
MediaTheme Auto - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/5 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
PowerSearch - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 2/26 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
ProgressBar - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 2/18 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
Radio group pattern - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 3/26 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
RadioList - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 3/14 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
RichTextEditor - 2 issue(s)
  • 🟠 serious: Ensure every ARIA input field has an accessible name
    • Rule: aria-input-field-name · Affects 2/18 stories · Learn more
    • WCAG: 4.1.2 (Level A)
  • 🔴 critical: Ensure every form element has a label
    • Rule: label · Affects 1/18 stories · Learn more
    • WCAG: 4.1.2 (Level A)
SelectableCard - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/4 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
Stepper - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/30 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
TableGroupedRows - 1 issue(s)
  • 🟠 serious: Ensure ARIA attributes are used as described in the specification of the element's role
    • Rule: aria-conditional-attr · Affects 3/3 stories · Learn more
    • WCAG: 4.1.2 (Level A)
TableTree - 1 issue(s)
  • 🟠 serious: Ensure ARIA attributes are used as described in the specification of the element's role
    • Rule: aria-conditional-attr · Affects 8/9 stories · Learn more
    • WCAG: 4.1.2 (Level A)
Text - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/23 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
Theme - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/5 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
PopArt - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 3/6 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
Thumbnail - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/12 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
Timestamp - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/20 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
Token - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 2/10 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
Tokenizer - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 2/24 stories · Learn more
    • WCAG: 1.4.3 (Level AA)

Visual Regression

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


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

@cixzhang
cixzhang merged commit a3f8184 into main Sep 21, 2026
33 of 34 checks passed
@github-actions
github-actions Bot deleted the night-watch-component-audit/ChatComposerInput/2026-09-21 branch September 22, 2026 06:23
AKnassa added a commit to AKnassa/astryx that referenced this pull request Sep 26, 2026
Resolved conflicts:
- packages/core/src/Chat/ChatComposerInput.tsx: kept the PR's
  handleRef.setValue alongside upstream's `focus: focusEditable`
  (meta#6419/meta#6398 keep an existing in-editor selection on focus); dropped the
  PR's local placeCaretAtEnd helper in favour of upstream's import from
  ./chatComposerSelection; handleKeyDown deps keep upstream's
  onKeyDownProp (meta#4280) and drop onChange, since submit-clear now reports
  through emitChange. The pending-emissions ledger auto-merged over
  upstream's one-shot pendingEchoValueRef, next to meta#6419's
  emitChangeVersionRef.
- packages/core/src/Chat/ChatComposerInput.test.tsx: took upstream's
  imports (waitFor, act, userEvent); the PR's controlled-value and
  trigger-menu tests auto-merged.
- packages/core/src/Chat/ChatComposerInput.doc.mjs: kept the PR's
  handleRef/value prose in upstream's prettier-wrapped layout, and recast
  the English/dense em dashes as punctuation per meta#4394.

Known fallout, fixed in the follow-up review commit (astracat F2): the
required `setValue` member breaks upstream's five-member handle literal in
useChatPasteAsToken.test.ts (TS2741 under the core typecheck).

This branch was successfully deployed

1 active deployment
Preview — c3ee0155 Deployed Sep 21, 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