fix(a11y): keep composer focusable while streaming - #46
Merged
Conversation
Use readOnly instead of disabled so focus is not dropped to body mid-stream, explain the wait via aria-describedby, and restore focus on completion if it was lost. Co-authored-by: Cursor <cursoragent@cursor.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughThe composer no longer becomes disabled while Cosmo streams a response. It stays focusable and becomes read-only. A localized accessibility hint describes the temporary state through Possibly related PRs
Fixed issue severity: Medium 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
readOnlyso the composer stays focusable and in the accessibility tree (A3).aria-describedbypointing at a short explanation (#promptInputBusyHint, viat()/ en+es).<body>/documentElementwhen the stream ends, return it to the composer. Do not steal focus if the user moved elsewhere (e.g. Stop).Closes #44
Changes
renderMessagescalls a smallsyncComposerAvailability(streaming)helper instead ofpromptInput.disabled = streaming. Disabling a focused control was what dropped keyboard users to<body>on every send.readOnlyblocks typing without removing the field from the tab order; Enter still cannot send mid-stream becauseisComposerSendAllowed()already gates on streaming status.DOM harness coverage asserts
readOnly/disabled,aria-describedbywiring, focus survival across a fake stream tick, and focus restore from<body>on idle. A1/A2/A11 reconciliation and the persistent#chatStatusregion are untouched.Test plan
npm test— 183 passed (includes 3 new A3 cases)npm run build+ server onPORT=3100;A11Y_CI=1 A11Y_BASE_URL=http://127.0.0.1:3100 npm run auditina11y-audits/tools— axe baseline gate passed (no shrink needed)prefers-color-scheme): composer stays focused underreadOnly; focus restores from<body>when cleared