🎨 Palette: Improve accessibility of scrollable output regions#3523
🎨 Palette: Improve accessibility of scrollable output regions#3523EffortlessSteven wants to merge 1 commit intomainfrom
Conversation
💡 What: Converted generic `<div>` output blocks with `overflow-y: auto` to use `role="region"`, `tabindex="0"`, and `aria-labelledby` linked to `<div>` labels instead of `<label>` tags. 🎯 Why: `<label>` tags are only valid for labellable form controls. Screen readers may ignore them when paired with generic `<div>` elements. Making the scrollable regions focusable ensures keyboard users can scroll them. 📸 Before/After: Visuals are identical, but under the hood, the markup correctly associates the "labels" with their respective content areas for assistive technologies. ♿ Accessibility: Ensures that keyboard-only users can focus and scroll through long model generation outputs, and that screen readers correctly announce the region names.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request improves the accessibility of scrollable output regions in the WASM browser examples by replacing improper tags with ARIA-compliant role="region" containers and adding tabindex="0" for keyboard navigation. Feedback includes correcting an unexpanded shell command in the documentation and recommending custom focus styles for the output regions to ensure the focus indicator is visible against dark backgrounds.
| ## 2024-05-22 - Keyboard Navigation in Custom Tabs | ||
| **Learning:** Custom tab implementations using ARIA roles (`tablist`, `tab`) often miss the expected keyboard interaction pattern (arrow keys to navigate), making them inaccessible to keyboard users despite having semantic roles. | ||
| **Action:** Always implement a `keydown` handler for custom tab components to support ArrowRight/ArrowLeft/Home/End navigation and automatic activation. | ||
| ## $(date +%Y-%m-%d) - Accessible Scrollable Regions |
There was a problem hiding this comment.
The date header contains an unexpanded shell command placeholder $(date +%Y-%m-%d). This should be replaced with the actual date to ensure the journal is correctly formatted and readable in markdown viewers.
| ## $(date +%Y-%m-%d) - Accessible Scrollable Regions | |
| ## 2024-05-22 - Accessible Scrollable Regions |
| <label>Streaming Output:</label> | ||
| <div id="streaming-output" class="streaming-output">Streaming output will appear here...</div> | ||
| <div id="streaming-output-label" class="fake-label">Streaming Output:</div> | ||
| <div id="streaming-output" class="streaming-output" role="region" aria-labelledby="streaming-output-label" tabindex="0">Streaming output will appear here...</div> |
There was a problem hiding this comment.
Adding tabindex="0" to the streaming output region is good for accessibility. However, because this region has a black background, the default browser focus indicator may be invisible or very difficult to see. Please add a custom focus style in your CSS (e.g., .streaming-output:focus-visible { outline: 2px solid #00ff00; }) to ensure keyboard users can clearly identify when the region is focused.
| <label>Streaming Output:</label> | ||
| <div id="streaming-output" class="streaming-output">Streaming output will appear here...</div> | ||
| <div id="streaming-output-label" class="fake-label">Streaming Output:</div> | ||
| <div id="streaming-output" class="streaming-output" role="region" aria-labelledby="streaming-output-label" tabindex="0">Streaming output will appear here...</div> |
There was a problem hiding this comment.
Adding tabindex="0" to the streaming output region is good for accessibility. However, because this region has a black background, the default browser focus indicator may be invisible or very difficult to see. Please add a custom focus style in your CSS (e.g., .streaming-output:focus-visible { outline: 2px solid #00ff00; }) to ensure keyboard users can clearly identify when the region is focused.
💡 What: Converted generic
<div>output blocks withoverflow-y: autoto userole="region",tabindex="0", andaria-labelledbylinked to<div>labels instead of<label>tags.🎯 Why:
<label>tags are only valid for labellable form controls. Screen readers may ignore them when paired with generic<div>elements. Making the scrollable regions focusable ensures keyboard users can scroll them.📸 Before/After: Visuals are identical, but under the hood, the markup correctly associates the "labels" with their respective content areas for assistive technologies.
♿ Accessibility: Ensures that keyboard-only users can focus and scroll through long model generation outputs, and that screen readers correctly announce the region names.
PR created automatically by Jules for task 15736208067410586540 started by @EffortlessSteven