Skip to content

fix(a11y)6-7-8: replace menu with list and make cluster chooser focusable#4392

Draft
Sagar-6203620715 wants to merge 1 commit intokubernetes-sigs:mainfrom
Sagar-6203620715:fix-access-6-7-8
Draft

fix(a11y)6-7-8: replace menu with list and make cluster chooser focusable#4392
Sagar-6203620715 wants to merge 1 commit intokubernetes-sigs:mainfrom
Sagar-6203620715:fix-access-6-7-8

Conversation

@Sagar-6203620715
Copy link
Contributor

Summary

This PR fixes multiple accessibility issues in ClusterChooserPopup by correcting ARIA roles, list structure, and focus behavior.

Related Issue

Partially fixes #4385
Addresses points 6, 7, and 8 from issue #4385

Changes

  • Replaced MenuList / MenuItem with semantic List / ListItemButton
  • Fixed invalid ARIA menu role and required-children violations
  • Ensured ListSubheader is contained within a proper list parent
  • Made the scrollable cluster list focusable using tabIndex={0}
  • Avoided introducing new ARIA role violations by not using role="listbox"

Tested by:

# Install frontend dependencies if not already installed
npm run install:frontend

# Check if TypeScript compiles (most important)
npm run frontend:tsc

# Run linting
npm run frontend:lint

# (Optional) Start Storybook after dependencies are installed
npm run frontend:storybook

@k8s-ci-robot k8s-ci-robot requested a review from sniok January 20, 2026 08:04
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Sagar-6203620715
Once this PR has been reviewed and has the lgtm label, please assign sniok for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot requested a review from yolossn January 20, 2026 08:04
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jan 20, 2026
Signed-off-by: Sagar Choudhary <sagar6203620715@gmail.com>
Copy link
Contributor

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

This PR addresses three accessibility violations in the ClusterChooserPopup component identified in issue #4385:

  • Fixes ARIA required children violations (point 6) by replacing MenuList/MenuItem with List/ListItemButton
  • Fixes list item structure violations (point 7) by ensuring ListSubheader is contained within a proper List parent
  • Addresses scrollable region focusability (point 8) by adding tabIndex={0} to the List

Changes:

  • Replaced MenuList with List and MenuItem with ListItemButton to use semantic HTML list structure instead of ARIA menu roles
  • Added tabIndex={0} to make the scrollable List keyboard focusable
  • Updated imports to reflect the component changes

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

<MenuList
<List
id="cluster-chooser-list"
tabIndex={0}
Copy link

Copilot AI Jan 31, 2026

Choose a reason for hiding this comment

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

Adding tabIndex={0} to the List makes it focusable, but there's no onKeyDown handler on the List itself - the keyboard navigation handler is on the TextField (line 247). This means:

  1. Users can tab to the List, but keyboard navigation (Arrow Up/Down, Enter) only works when the TextField is focused
  2. This creates a confusing UX where tabbing to the List provides no interactive functionality

Consider either:

  • Removing tabIndex={0} from the List since the ListItemButton children are already focusable and keyboard-navigable
  • Or moving/duplicating the onKeyDown handler to the List component to enable keyboard navigation from the List itself

The scrollable region accessibility requirement is likely already satisfied by having focusable children (ListItemButtons) within the scrollable container.

Suggested change
tabIndex={0}

Copilot uses AI. Check for mistakes.
<MenuItem
<ListItemButton
selected={selected}
key={`recent_cluster_${cluster.name}`}
Copy link

Copilot AI Jan 31, 2026

Choose a reason for hiding this comment

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

The key prop on line 49 is redundant. The key prop is already correctly specified where ClusterListItem is rendered (lines 292 and 303). React does not pass the key prop to child components, so this has no effect. Consider removing it to avoid confusion.

Suggested change
key={`recent_cluster_${cluster.name}`}

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@illume illume left a comment

Choose a reason for hiding this comment

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

Thanks for this!

To update the snapshots you can run this.

npm run test -- -u

You can check things locally with these commands.

npm run tsc
npm run lint
npm run test
npm run format

Please check the open comments?

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 5, 2026
@k8s-ci-robot
Copy link
Contributor

PR needs rebase.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@illume
Copy link
Contributor

illume commented Feb 14, 2026

hey hey.

I'll mark this as draft for now to make it easier on reviewers. If you want to continue it, please mark it as ready to review when you've pushed changes.

@illume illume marked this pull request as draft February 14, 2026 13:00
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WIP: Accessibility Issues Tracking

3 participants