Skip to content

🎨 Palette: Improve WikiCollapsible accessibility with useId#38

Open
aicoder2009 wants to merge 2 commits intomainfrom
palette-ux-collapsible-a11y-7882188171366172839
Open

🎨 Palette: Improve WikiCollapsible accessibility with useId#38
aicoder2009 wants to merge 2 commits intomainfrom
palette-ux-collapsible-a11y-7882188171366172839

Conversation

@aicoder2009
Copy link
Copy Markdown
Owner

🎨 Palette: Improve WikiCollapsible accessibility with useId

💡 What:
Updated the WikiCollapsible component to use React's useId hook for generating unique IDs and mapped them correctly to aria-controls and aria-expanded attributes.

🎯 Why:
Custom interactive widgets often lack proper accessibility context for screen readers. Using useId ensures that every instance of a collapsible element has a unique ID, creating a direct and accurate relationship between the toggle button and its content container.

📸 Before/After:
No visual change, but structural accessibility is improved.

♿ Accessibility:

  • Added unique ID generation using useId
  • Added aria-expanded to indicate toggle state
  • Added aria-controls mapping the toggle to the content container
  • Added dynamic aria-label indicating the "Show/Hide" action on the specific title

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

💡 What:
Updated the WikiCollapsible component to use React's useId hook for generating unique IDs and mapped them correctly to aria-controls and aria-expanded attributes.

🎯 Why:
Custom interactive widgets often lack proper accessibility context for screen readers. Using useId ensures that every instance of a collapsible element has a unique ID, creating a direct and accurate relationship between the toggle button and its content container.

📸 Before/After:
No visual change, but structural accessibility is improved.

♿ Accessibility:
- Added unique ID generation using useId
- Added aria-expanded to indicate toggle state
- Added aria-controls mapping the toggle to the content container
- Added dynamic aria-label indicating the "Show/Hide" action on the specific title

Co-authored-by: aicoder2009 <127642633+aicoder2009@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 29, 2026 10:22
@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 29, 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:15pm

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 the accessibility semantics of the WikiCollapsible UI widget by generating a unique content container ID via React useId and wiring it to the toggle button’s ARIA attributes.

Changes:

  • Add useId()-generated ID for the collapsible content container.
  • Add aria-expanded, aria-controls, and a dynamic aria-label to the toggle button.
  • Add a .jules/palette.md note capturing the accessibility learning/pattern.

Reviewed changes

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

File Description
src/components/wiki/wiki-collapsible.tsx Adds useId and ARIA wiring between the toggle button and collapsible content.
.jules/palette.md Documents the “use useId for aria-controls mapping” accessibility guideline.

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

</button>
</div>
{isOpen && <div className="px-4 py-3">{children}</div>}
{isOpen && <div id={contentId} className="px-4 py-3">{children}</div>}
@@ -22,11 +23,14 @@ export function WikiCollapsible({
<button
@@ -22,11 +23,14 @@ export function WikiCollapsible({
<button
onClick={() => setIsOpen(!isOpen)}
@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