Skip to content

🎨 Palette: Add keyboard navigation to browser example tabs#754

Draft
EffortlessSteven wants to merge 1 commit intomainfrom
palette-tabs-keyboard-nav-14475259408153707242
Draft

🎨 Palette: Add keyboard navigation to browser example tabs#754
EffortlessSteven wants to merge 1 commit intomainfrom
palette-tabs-keyboard-nav-14475259408153707242

Conversation

@EffortlessSteven
Copy link
Member

💡 What: Added full keyboard navigation support for the tabs in the browser example.
🎯 Why: The previous implementation relied solely on click events, making it difficult for keyboard users to navigate between sections efficiently.
📸 Before/After: No visual changes, but behavioral improvement verified via Playwright script showing focus moving with arrow keys.
♿ Accessibility: Supports ArrowRight/ArrowLeft/Home/End keys for navigating the tab list, fulfilling ARIA authoring practices for role="tablist".


PR created automatically by Jules for task 14475259408153707242 started by @EffortlessSteven

- Added `keydown` event listener to the `.tabs` container in `main.js`.
- Implemented `ArrowRight`, `ArrowLeft`, `Home`, and `End` key handling for navigating between tabs.
- Ensured focus moves to the new tab and it is automatically activated (clicked).
- This improves accessibility for keyboard users and aligns with ARIA Tab Pattern practices.
@google-labs-jules
Copy link

👋 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.

Copilot AI review requested due to automatic review settings February 26, 2026 02:35
@gemini-code-assist
Copy link

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@coderabbitai
Copy link

coderabbitai bot commented Feb 26, 2026

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.

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
  • Post copyable unit tests in a comment
  • Commit unit tests in branch palette-tabs-keyboard-nav-14475259408153707242

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 and usage tips.

Copy link

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

Adds keyboard navigation to the BitNet WASM browser example’s tab UI to improve accessibility and match expected role="tablist" interactions.

Changes:

  • Initialize tab keyboard navigation during app startup.
  • Add keydown handling for ArrowLeft/ArrowRight/Home/End to move between tabs and activate them.
  • Document the accessibility learning in Palette’s journal.

Reviewed changes

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

File Description
crates/bitnet-wasm/examples/browser/main.js Adds setupTabNavigation() and wires it into initialization to enable keyboard-driven tab navigation.
.jules/palette.md Records a learning/action item about implementing keyboard interactions for custom ARIA tabs.

if (!tabsContainer) return;

tabsContainer.addEventListener('keydown', (e) => {
const tabs = Array.from(document.querySelectorAll('.tab'));
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

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

setupTabNavigation collects tabs via document.querySelectorAll('.tab'), which can accidentally include any other .tab elements on the page (now or in the future) and break navigation ordering. Prefer scoping to the tablist container (e.g., tabsContainer.querySelectorAll(...)) and/or selecting by role ([role="tab"]) within the container.

Suggested change
const tabs = Array.from(document.querySelectorAll('.tab'));
const tabs = Array.from(tabsContainer.querySelectorAll('.tab'));

Copilot uses AI. Check for mistakes.
Comment on lines +585 to +590
if (handled) {
e.preventDefault();
const nextTab = tabs[nextIndex];
nextTab.focus();
nextTab.click(); // Activate the tab
}
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

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

The ARIA tabs pattern typically uses a roving tabindex (active tab tabindex=0, inactive tabs tabindex=-1) so Tab moves out of the tablist rather than visiting every tab. This change moves focus with arrow keys but never updates tabindex, so all tabs remain in the Tab order and keyboard UX won’t match the expected pattern.

Copilot uses AI. Check for mistakes.
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