Skip to content

🎨 Palette: Semantic interactive elements for visualizer - #610

Open
sheepdestroyer wants to merge 4 commits into
masterfrom
palette/semantic-interactive-elements-2846542459358061979
Open

🎨 Palette: Semantic interactive elements for visualizer#610
sheepdestroyer wants to merge 4 commits into
masterfrom
palette/semantic-interactive-elements-2846542459358061979

Conversation

@sheepdestroyer

@sheepdestroyersheepdestroyer commented Aug 29, 2026

Copy link
Copy Markdown
Owner

💡 What: Replaced interactive <div> and <a> elements with native <button type="button"> elements in the dataset visualizer. Added CSS resets to maintain existing styling.

🎯 Why: Using custom divs for interactive items creates non-semantic markup and requires manual tabindex/keydown handlers. Native buttons provide out-of-the-box keyboard support and correct screen-reader semantics.

📸 Before/After: Visual presentation remains identical, but keyboard navigation and screen-reader experience are improved.

♿ Accessibility: Ensures list items and the "clear annotation" action announce correctly as interactive buttons to screen readers, and provide native keyboard focus and activation without custom JavaScript handlers.


PR created automatically by Jules for task 2846542459358061979 started by @sheepdestroyer

Summary by Sourcery

Improve visualizer accessibility with semantic controls and align the agy fallback configuration with the supported Claude model.

New Features:

  • Use native buttons for dataset visualizer prompt items and annotation clearing to improve keyboard navigation and screen-reader semantics.

Bug Fixes:

  • Update the agy fallback tier and related examples and tests to use the configured Claude Sonnet model identifier.

Enhancements:

  • Preserve the visualizer's existing appearance while styling native buttons to match the current list and annotation controls.

Documentation:

  • Update model documentation and usage examples to reflect the revised agy fallback model.

Tests:

  • Update agy tier and quota-reset test configuration for the revised fallback model.

Co-authored-by: sheepdestroyer <1377479+sheepdestroyer@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.

@sourcery-ai

sourcery-aiBot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

The visualizer now uses native buttons for prompt selection and annotation clearing, removing custom keyboard interaction code while preserving the existing visual design through targeted CSS resets and styles.

Sequence diagram for accessible prompt selection

sequenceDiagram
participant User
participant PromptButton as PromptButton
participant Visualizer as Visualizer
User->>PromptButton: Native keyboard or pointer activation
PromptButton->>Visualizer: onclick selectPrompt(index)
Visualizer-->>User: Render selected prompt
Loading

File-Level Changes

ChangeDetailsFiles
Converted visualizer prompt items to native buttons while preserving their appearance and selection behavior.
  • Replaced custom focusable list-item divs and manual keyboard handling with <button type="button"> elements.
  • Added button CSS resets and layout properties to retain the existing list-item styling and focus treatment.
router/static/visualizer.html
Made the annotation-clearing action a semantic, keyboard-accessible button.
  • Replaced the clear-annotation anchor with a styled button while retaining its action and inline presentation.
router/static/visualizer.html
Recorded the accessibility implementation guidance for future palette work.
  • Documented the recommendation to use native buttons for interactive list items and compensate with CSS resets.
.Jules/palette.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai

coderabbitaiBot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 36c29741-19eb-46be-aa28-4c91106b55d6


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.

@github-actionsgithub-actionsBot added documentation Improvements or additions to documentation router labels Aug 29, 2026

@sourcery-aisourcery-aiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey - I've found 2 issues

Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments### Comment 1
<locationpath="router/static/visualizer.html"line_range="255" />
<code_context>
const displayPred = pred ? escapeHtml(pred.replace('agent-','')) : '';
- return `<divclass="list-item${i === selectedIdx ? ' selected' : ''}"onclick="selectPrompt(${i})"tabindex="0"role="button"aria-label="Prompt ${i}"onkeydown="if(event.key==='Enter'||event.key===''){event.preventDefault();selectPrompt(${i})}">
+ return `<buttontype="button"class="list-item${i === selectedIdx ? ' selected' : ''}"onclick="selectPrompt(${i})"aria-label="Prompt ${i}">
<divclass="id">#${i} · LLM: ${displayLlm}${pred ? ' · CLS: ' + displayPred : ''}</div>
<divclass="snippet">${escapeHtml(p.prompt.substring(0, 120))}</div>
</code_context>
<issue_to_address>
**issue (bug_risk):** The `aria-label="Prompt ${i}"` overrides the button's descendant text in the accessible name calculation, so screen readers announce only a generic prompt number and omit the prompt snippet, LLM label, classifier label, and review tags.
**Triggers:** When a screen-reader user navigates the prompt list.
**Suggested fix:** Remove the `aria-label` so the button's content supplies its name, or construct an accessible label that includes the prompt and relevant labels.
```suggestion return `<button type="button" class="list-item${i === selectedIdx ? ' selected' : ''}" onclick="selectPrompt(${i})">```
</issue_to_address>
### Comment 2
<locationpath="router/static/visualizer.html"line_range="256-258" />
<code_context>
- return `<divclass="list-item${i === selectedIdx ? ' selected' : ''}"onclick="selectPrompt(${i})"tabindex="0"role="button"aria-label="Prompt ${i}"onkeydown="if(event.key==='Enter'||event.key===''){event.preventDefault();selectPrompt(${i})}">
+ return `<buttontype="button"class="list-item${i === selectedIdx ? ' selected' : ''}"onclick="selectPrompt(${i})"aria-label="Prompt ${i}">
<divclass="id">#${i} · LLM: ${displayLlm}${pred ? ' · CLS: ' + displayPred : ''}</div>
<divclass="snippet">${escapeHtml(p.prompt.substring(0, 120))}</div>
<divclass="tags">${tags}</div>
- </div>`;
+ </button>`;
</code_context>
<issue_to_address>
**nitpick (bug_risk):** Each native `<button>` contains three `<div>` descendants, but a button's HTML content model permits only phrasing content. The generated list markup is therefore invalid and does not provide a valid native-button structure for HTML validators and accessibility tooling.
**Triggers:** Whenever the prompt list is rendered.
**Suggested fix:** Use phrasing elements such as `<span>` for the button's children, applying `display: block` to the layout spans as needed.
```suggestion <span class="id" style="display:block">#${i} · LLM: ${displayLlm}${pred ? ' · CLS: ' + displayPred : ''}</span> <span class="snippet" style="display:block">${escapeHtml(p.prompt.substring(0, 120))}</span> <span class="tags">${tags}</span>```
</issue_to_address>

Sourcery assessment

Approval pending. 1 finding to address first.

Blocking findings: router/static/visualizer.html:255


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

const displayPred = pred ? escapeHtml(pred.replace('agent-','')) : '';

return `<div class="list-item${i === selectedIdx ? ' selected' : ''}" onclick="selectPrompt(${i})" tabindex="0" role="button" aria-label="Prompt ${i}" onkeydown="if(event.key==='Enter'||event.key===' '){event.preventDefault();selectPrompt(${i})}">
return `<button type="button" class="list-item${i === selectedIdx ? ' selected' : ''}" onclick="selectPrompt(${i})" aria-label="Prompt ${i}">

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

issue (bug_risk): The aria-label="Prompt ${i}" overrides the button's descendant text in the accessible name calculation, so screen readers announce only a generic prompt number and omit the prompt snippet, LLM label, classifier label, and review tags.

Triggers: When a screen-reader user navigates the prompt list.

Suggested fix: Remove the aria-label so the button's content supplies its name, or construct an accessible label that includes the prompt and relevant labels.

Suggested change
return `<buttontype="button" class="list-item${i === selectedIdx ? ' selected' : ''}" onclick="selectPrompt(${i})"aria-label="Prompt ${i}">
return `<buttontype="button" class="list-item${i === selectedIdx ? ' selected' : ''}" onclick="selectPrompt(${i})">

Comment on lines 256 to 258
<div class="id">#${i} · LLM: ${displayLlm}${pred ? ' · CLS: ' + displayPred : ''}</div>
<div class="snippet">${escapeHtml(p.prompt.substring(0, 120))}</div>
<div class="tags">${tags}</div>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nitpick (bug_risk): Each native <button> contains three <div> descendants, but a button's HTML content model permits only phrasing content. The generated list markup is therefore invalid and does not provide a valid native-button structure for HTML validators and accessibility tooling.

Triggers: Whenever the prompt list is rendered.

Suggested fix: Use phrasing elements such as <span> for the button's children, applying display: block to the layout spans as needed.

Suggested change
<divclass="id">#${i} · LLM: ${displayLlm}${pred ? ' · CLS: ' + displayPred : ''}</div>
<divclass="snippet">${escapeHtml(p.prompt.substring(0, 120))}</div>
<divclass="tags">${tags}</div>
<spanclass="id"style="display:block">#${i} · LLM: ${displayLlm}${pred ? ' · CLS: ' + displayPred : ''}</span>
<spanclass="snippet"style="display:block">${escapeHtml(p.prompt.substring(0, 120))}</span>
<spanclass="tags">${tags}</span>

google-labs-julesBotand others added 3 commits August 29, 2026 05:19
Co-authored-by: sheepdestroyer <1377479+sheepdestroyer@users.noreply.github.com>
Co-authored-by: sheepdestroyer <1377479+sheepdestroyer@users.noreply.github.com>
Co-authored-by: sheepdestroyer <1377479+sheepdestroyer@users.noreply.github.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentationImprovements or additions to documentationrouterscriptstests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@sheepdestroyer