fix(ui): keyboard a11y for the reply preview strip#211
Merged
Conversation
The quoted-reply preview at the top of a reply message had cursor-pointer and an onclick handler but was otherwise a plain div: no tabindex, no role, no key handler, and the hover-expand CSS only matched `:hover`. Keyboard users could neither reach it nor activate it, and they never saw the full preview text. Make the strip a proper button affordance: - role="button", tabindex="0", aria-label - onkeydown handler for Enter and Space that runs the same scroll-to- original logic as onclick (Space calls preventDefault so the page doesn't scroll) - new `.reply-strip:focus-visible` CSS rule (outside the hover/pointer media query so it applies on touch devices too) that expands the preview and adds a visible outline Playwright regression tests cover: ARIA attributes, focusability, presence of the :focus-visible rule in the shipped stylesheet, and Enter-key activation of the scroll-to-original handler. 92 passed, 3 pre-existing mobile-hover skips. Closes #210. [AI-assisted - Claude]
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.
Problem
The quoted-reply preview at the top of a reply message (
.reply-strip) hadcursor-pointerand anonclickhandler but was otherwise a plain<div>: notabindex, norole, no key handler, and the hover-expand CSS only matched:hover. Keyboard users could neither reach it nor activate it, and they never saw the full preview text. PR #209 (the layout fix for #205/#206/#207) called this gap out and filed it as a follow-up.Approach
Make the reply strip a proper button affordance:
role="button",tabindex="0",aria-labelso screen readers announce it and Tab navigation reaches it.onkeydownhandler for Enter and Space that runs the same scroll-to-original logic as the existing onclick (Space callspreventDefault()so the page doesn't scroll)..reply-strip:focus-visibleCSS rule outside the(hover: hover)media query so it applies on all devices — mobile keyboard users (e.g. external Bluetooth keyboards on phones) are covered too. The rule expands the preview and adds a visible outline.Testing
New Playwright tests in
ui/tests/message-layout.spec.ts:role,tabindex,aria-labelare all present; the strip accepts focus..reply-strip:focus-visiblerule is shipped. (Testing the computed style under actual keyboard focus is unreliable in headless browsers because:focus-visibleis modality-dependent.)reply-highlightclass.Full suite: 92 passed, 3 skipped (the pre-existing mobile-hover skips from PR #209).
Delegate / contract WASM
UI-only:
ui/assets/main.css,ui/src/components/conversation.rs,ui/tests/message-layout.spec.ts. No delegate/contract/common touched, no migration entry required.Fixes
Closes #210.
[AI-assisted - Claude]