Skip to content

🎨 Palette: [UX improvement] Improve playground button a11y#119

Draft
lavkushry wants to merge 1 commit into
mainfrom
palette/improve-playground-button-a11y-7084237943914985350
Draft

🎨 Palette: [UX improvement] Improve playground button a11y#119
lavkushry wants to merge 1 commit into
mainfrom
palette/improve-playground-button-a11y-7084237943914985350

Conversation

@lavkushry

Copy link
Copy Markdown
Owner

💡 What: Added a visible focus state for keyboard navigation and an aria-label for 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-visible state)
Accessibility: Improved keyboard navigation focus visibility (:focus-visible outline). Improved screen reader experience by adding contextual aria-label attribute.


PR created automatically by Jules for task 7084237943914985350 started by @lavkushry

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>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2d09879b-d72c-489f-a842-33f743e6ab1a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch palette/improve-playground-button-a11y-7084237943914985350

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@gemini-code-assist gemini-code-assist 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.

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.

Comment thread theme/visual-edition.css
Comment on lines +1586 to +1590
.playground-btn:focus-visible {
outline: 2px solid var(--ownership, #E63946);
outline-offset: 2px;
opacity: 1;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

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.

Suggested change
.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;
}

Comment thread theme/visual-edition.js
btn.className = 'playground-btn';
btn.textContent = 'Run';
btn.title = 'Open in Rust Playground';
btn.setAttribute('aria-label', 'Run code in Rust Playground');

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
btn.setAttribute('aria-label', 'Run code in Rust Playground');
btn.setAttribute('aria-label', 'Run code in Rust Playground (opens in a new tab)');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant