Skip to content

🎨 Palette: Improve Accessibility for WikiTabs and WikiCollapsible#29

Open
aicoder2009 wants to merge 2 commits intomainfrom
palette/a11y-collapsible-tabs-3307602881622537608
Open

🎨 Palette: Improve Accessibility for WikiTabs and WikiCollapsible#29
aicoder2009 wants to merge 2 commits intomainfrom
palette/a11y-collapsible-tabs-3307602881622537608

Conversation

@aicoder2009
Copy link
Copy Markdown
Owner

💡 What: Added role="tablist", role="tab", aria-selected and tabIndex attributes to WikiTabs, and added useId for unique aria-controls mapping on WikiCollapsible.
🎯 Why: Makes interactive collapsible widgets and tabs much more intuitive for screen reader users by properly associating toggles with their respective content panels, and defining appropriate widget roles.
♿ Accessibility: Improves screen reader context, keyboard navigation structure, and addresses missing structural roles for tab components.


PR created automatically by Jules for task 3307602881622537608 started by @aicoder2009

Co-authored-by: aicoder2009 <127642633+aicoder2009@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.

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
opencitation Ready Ready Preview, Comment May 1, 2026 6:23pm

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Improves accessibility semantics for wiki UI primitives by adding ARIA roles/states to WikiTabs and adding stable ID-based control/panel relationships to WikiCollapsible.

Changes:

  • Add role="tablist" on the tabs container and role="tab" + aria-selected + tabIndex on each tab button.
  • Add useId()-generated aria-controls/id wiring plus aria-expanded and dynamic aria-label to the collapsible toggle.
  • Add a short internal note in .jules/palette.md capturing the accessibility approach.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 5 comments.

File Description
src/components/wiki/wiki-tabs.tsx Adds ARIA tab roles/states to the tab strip.
src/components/wiki/wiki-collapsible.tsx Adds useId-based aria-controls/id mapping and expanded/label attributes.
.jules/palette.md Documents the accessibility learning/action for these widgets.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +17 to +23
<div className="flex border-b border-wiki-border-light" role="tablist">
{tabs.map((tab) => (
<button
key={tab.id}
role="tab"
aria-selected={tab.active ? "true" : "false"}
tabIndex={tab.active ? 0 : -1}
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

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

role="tab"/role="tablist" is being applied, but the tabs are not programmatically associated with a tab panel (no id on the tab and no aria-controls pointing at a corresponding role="tabpanel"). This can confuse assistive tech because it announces a tabs widget without the required relationships. Consider either (a) extending Tab to include a panel id and wiring id+aria-controls (and updating consuming markup to use role="tabpanel" + aria-labelledby), or (b) removing the tab roles if this component is only a visual switcher.

Suggested change
<div className="flex border-b border-wiki-border-light" role="tablist">
{tabs.map((tab) => (
<button
key={tab.id}
role="tab"
aria-selected={tab.active ? "true" : "false"}
tabIndex={tab.active ? 0 : -1}
<div className="flex border-b border-wiki-border-light">
{tabs.map((tab) => (
<button
key={tab.id}
type="button"

Copilot uses AI. Check for mistakes.
Comment on lines +21 to +23
role="tab"
aria-selected={tab.active ? "true" : "false"}
tabIndex={tab.active ? 0 : -1}
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

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

aria-selected is being passed as the strings "true"/"false"; in React this should be a boolean so the attribute is correctly typed and consistent with other ARIA props. Also, if no tab is marked active, all tabs will end up with tabIndex={-1} and none will be reachable by keyboard—consider a fallback that makes the first tab focusable when there is no active tab.

Copilot uses AI. Check for mistakes.
Comment on lines +21 to 24
role="tab"
aria-selected={tab.active ? "true" : "false"}
tabIndex={tab.active ? 0 : -1}
onClick={() => onTabChange?.(tab.id)}
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

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

After adding role="tab", the ARIA tabs pattern expects keyboard interaction (e.g., arrow keys/Home/End to move focus between tabs) rather than relying only on Tab/Shift+Tab. Consider adding an onKeyDown handler to implement roving focus and activation behavior, or omit role="tab" if that interaction isn’t intended.

Copilot uses AI. Check for mistakes.
</button>
</div>
{isOpen && <div className="px-4 py-3">{children}</div>}
{isOpen && <div id={contentId} className="px-4 py-3">{children}</div>}
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

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

aria-controls points to contentId, but the controlled element is conditionally rendered ({isOpen && ...}), so when collapsed the id referenced by aria-controls doesn’t exist in the DOM. For better AT support, keep the content container rendered with a stable id and toggle visibility via hidden/aria-hidden (and/or CSS), rather than removing it entirely.

Suggested change
{isOpen && <div id={contentId} className="px-4 py-3">{children}</div>}
<div
id={contentId}
className="px-4 py-3"
hidden={!isOpen}
aria-hidden={!isOpen}
>
{children}
</div>

Copilot uses AI. Check for mistakes.
Comment on lines 23 to +33
<button
onClick={() => setIsOpen(!isOpen)}
className="text-wiki-link text-sm hover:underline"
aria-expanded={isOpen}
aria-controls={contentId}
aria-label={isOpen ? `Hide ${title}` : `Show ${title}`}
>
[{isOpen ? "hide" : "show"}]
</button>
</div>
{isOpen && <div className="px-4 py-3">{children}</div>}
{isOpen && <div id={contentId} className="px-4 py-3">{children}</div>}
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

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

Consider adding landmark semantics to the collapsible content: when expanded, the content container can use role="region" and aria-labelledby pointing at an id on the toggle button (or title) so screen readers can identify what the region contains. Right now only aria-controls is set, but the panel itself has no accessible name/relationship back to the control.

Copilot uses AI. Check for mistakes.
@aicoder2009 aicoder2009 closed this May 1, 2026
@aicoder2009 aicoder2009 reopened this May 1, 2026
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.

2 participants