🎨 Palette: [UX improvement] Improve playground button a11y#119
🎨 Palette: [UX improvement] Improve playground button a11y#119lavkushry wants to merge 1 commit into
Conversation
Added `:focus-visible` outline for keyboard navigation on the 'Run' playground buttons over code blocks. Added `aria-label` to the 'Run' playground buttons to give better context for screen reader users on where the link will take them. Updated Playwright visual snapshots to accommodate the focus state changes. Co-authored-by: lavkushry <106930153+lavkushry@users.noreply.github.com>
|
👋 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: defaults 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 the injected Rust Playground buttons by adding custom focus-visible styles and descriptive ARIA labels. The review feedback highlights two important improvements: increasing the CSS selector specificity for the focus-visible styles to prevent them from being overridden by more general rules, and appending a notice to the ARIA label to inform screen reader users that the link opens in a new tab.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| .playground-btn:focus-visible { | ||
| outline: 2px solid var(--ownership, #E63946); | ||
| outline-offset: 2px; | ||
| opacity: 1; | ||
| } |
There was a problem hiding this comment.
The selector .playground-btn:focus-visible has a specificity of (0, 2, 0). However, there is a more general selector #mdbook-content main a:focus-visible on line 146 with a higher specificity of (1, 1, 2) due to the ID selector #mdbook-content.
Because of this, the custom outline styles and offset you defined here will be overridden by the default focus outline styles. To ensure your custom focus outline is applied, you should increase the specificity of this selector.
| .playground-btn:focus-visible { | |
| outline: 2px solid var(--ownership, #E63946); | |
| outline-offset: 2px; | |
| opacity: 1; | |
| } | |
| #mdbook-content main .playground-btn:focus-visible { | |
| outline: 2px solid var(--ownership, #E63946); | |
| outline-offset: 2px; | |
| opacity: 1; | |
| } |
| btn.className = 'playground-btn'; | ||
| btn.textContent = 'Run'; | ||
| btn.title = 'Open in Rust Playground'; | ||
| btn.setAttribute('aria-label', 'Run code in Rust Playground'); |
There was a problem hiding this comment.
Since the playground link opens in a new tab (target = '_blank'), it is an accessibility best practice to inform screen reader users about this behavior. Consider appending (opens in a new tab) to the aria-label.
| btn.setAttribute('aria-label', 'Run code in Rust Playground'); | |
| btn.setAttribute('aria-label', 'Run code in Rust Playground (opens in a new tab)'); |
💡 What: Added a visible focus state for keyboard navigation and an
aria-labelfor screen readers to the injected Rust playground "Run" buttons on code blocks.🎯 Why: Previously, when navigating the handbook with a keyboard, it was hard to tell when focus was on the "Run" button over a code block. Also, the label "Run" was not descriptive enough for screen reader users when taking them to an external site.
📸 Before/After:
(See Playwright frontend verification screenshot for the new
:focus-visiblestate)♿ Accessibility: Improved keyboard navigation focus visibility (
:focus-visibleoutline). Improved screen reader experience by adding contextualaria-labelattribute.PR created automatically by Jules for task 7084237943914985350 started by @lavkushry