Skip to content

fix(chat): show composer focus ring for keyboard - #5648

Merged
rubyycheung merged 10 commits into
mainfrom
codex/chat-composer-keyboard-focus
Sep 2, 2026
Merged

fix(chat): show composer focus ring for keyboard#5648
rubyycheung merged 10 commits into
mainfrom
codex/chat-composer-keyboard-focus

Conversation

@rubyycheung

Copy link
Copy Markdown
Contributor

Summary

  • add the shared focus outline when keyboard focus enters the ChatComposer editor
  • suppress the composer-level ring for pointer focus
  • leave focus indication on internal buttons instead of ringing the whole composer
  • document the behavior and add a patch changeset

Why

The elevated composer intentionally preserved its legacy low-to-medium shadow change on focus, but shadow depth is not a reliable WCAG focus indicator. WCAG 2.4.7 requires visible keyboard focus, and WCAG 1.4.11 requires an author-supplied focus indicator to reach 3:1 against adjacent colors.

This keeps elevation as visual depth and adds a separate, theme-controlled focus outline.

References:

Verification

  • pnpm exec vitest run packages/core/src/Chat/ChatComposer.test.tsx packages/core/src/Chat/ChatComposerInput.test.tsx
  • pnpm --filter @astryxdesign/core exec tsc --noEmit
  • pnpm exec eslint packages/core/src/Chat/ChatComposer.tsx packages/core/src/Chat/ChatComposer.test.tsx
  • pnpm check:changesets

@rubyycheung

@vercel

vercel Bot commented Aug 28, 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 2, 2026 8:03am UTC

Request Review

@github-actions github-actions Bot added the needs:code-review High-risk change (new package/component/API) — needs human code review before merge label Aug 28, 2026
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Aug 28, 2026
github-actions Bot added a commit that referenced this pull request Aug 28, 2026
@github-actions

github-actions Bot commented Aug 28, 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

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

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 14 compared shot(s).


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

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

Automated review confirmed the keyboard focus ring at the current head. One documentation mismatch remains: the Chinese and dense elevation descriptions still omit the new keyboard-only ring. Updating both would keep the published focus contract aligned.

[Automated review]

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

Thanks for the cleanup. The keyboard focus behavior now checks out at this head, but the Chinese and dense public docs still describe the old elevation-only contract. Could you update those two elevation entries too so all docs mention the keyboard-only body ring and pointer behavior?

[Automated review]

@rubyycheung
rubyycheung enabled auto-merge (squash) August 30, 2026 19:23

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

Approved at exact head; docs and keyboard-only focus behavior are aligned. @imdreamrunner, this looks ready for your approval.

[Automated review]

@rubyycheung

Copy link
Copy Markdown
Contributor Author

Synced this branch with current main, including the current interaction-modality architecture from #5734.

Added explicit regression coverage for its last-input invariant:

  • programmatic editor focus after keyboard input shows the composer ring
  • programmatic editor focus after pointer input keeps the composer ring hidden

Local verification passed:

  • pnpm exec vitest run packages/core/src/Chat/ChatComposer.test.tsx packages/core/src/Chat/ChatComposerInput.test.tsx (62 tests)
  • pnpm exec eslint packages/core/src/Chat/ChatComposer.tsx packages/core/src/Chat/ChatComposer.test.tsx
  • pnpm --filter @astryxdesign/core exec tsc --noEmit
  • pnpm check:changesets
  • pnpm check:knowledge
  • repository pre-commit checks

The updated Storybook preview should be used for the architecture record’s real-browser verification of keyboard focus, pointer suppression/clearing, internal-button ownership, and programmatic focus after both modalities.

github-actions Bot added a commit that referenced this pull request Sep 2, 2026
@cixzhang
cixzhang force-pushed the codex/chat-composer-keyboard-focus branch from 14f2588 to 40a5397 Compare September 2, 2026 05:22
github-actions Bot added a commit that referenced this pull request Sep 2, 2026

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

Thanks, the keyboard-only composer ring works across keyboard, pointer, touch, programmatic focus, and internal-button ownership.

One thing still blocks this head: the new Chat RTL target never measures an assistant bubble. core-chat--default renders assistant responses as Markdown, so that selector matches zero and pr-rtl stays red. Please target two elements that both exist in the story, or add a dedicated fixture, so D2 produces a real result.

[Reviewed by Robohands]

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

Thanks, the prior RTL blocker is fixed: the Mixed Content target now measures both sender bubbles. Exact-head focus ownership also passes.

[Reviewed by Robohands]

@github-actions github-actions Bot removed the needs:code-review High-risk change (new package/component/API) — needs human code review before merge label Sep 2, 2026
@rubyycheung
rubyycheung merged commit 4f39c7e into main Sep 2, 2026
28 checks passed
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.

3 participants