Skip to content

Conversation

@Rajdeepc
Copy link
Contributor

@Rajdeepc Rajdeepc commented Oct 24, 2025

Description

Fixes a critical keyboard accessibility bug in <sp-menu selects="multiple">:
Double-toggle bug: Space/Enter keys toggled selection twice, making items appear unselectable

Problem

Users reported that keyboard interaction was broken for multiple selection menus:

  • Pressing Space/Enter would select then immediately deselect items
  • Pattern effectively unusable for keyboard-only users

Changes

1. Fixed double-toggle in Menu.ts

File: packages/menu/src/Menu.ts

The keyboard handler was calling selectOrToggleItem() twice - once through .click() and once directly:

  if (key === ' ' || key === 'Enter') {
      event.preventDefault();
+     // The click() method already triggers selection via handlePointerBasedSelection
+     // so we don't need to call selectOrToggleItem again here.
      root?.focusElement?.click();
-     if (root) this.selectOrToggleItem(root);
      return;
  }

Motivation and context

Related issue(s)

  • fixes [Issue Number]

Screenshots (if appropriate)


Author's checklist

  • I have read the CONTRIBUTING and PULL_REQUESTS documents.
  • I have reviewed at the Accessibility Practices for this feature, see: Aria Practices
  • I have added automated tests to cover my changes.
  • I have included a well-written changeset if my change needs to be published.
  • I have included updated documentation if my change required it.

Reviewer's checklist

  • Includes a Github Issue with appropriate flag or Jira ticket number without a link
  • Includes thoughtfully written changeset if changes suggested include patch, minor, or major features
  • Automated tests cover all use cases and follow best practices for writing
  • Validated on all supported browsers
  • All VRTs are approved before the author can update Golden Hash

Manual review test cases

Device review

  • Did it pass in Desktop?
  • Did it pass in (emulated) Mobile?
  • Did it pass in (emulated) iPad?

@changeset-bot
Copy link

changeset-bot bot commented Oct 24, 2025

⚠️ No Changeset found

Latest commit: c37162c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@Rajdeepc Rajdeepc self-assigned this Oct 24, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Oct 24, 2025

📚 Branch Preview

🔍 Visual Regression Test Results

When a visual regression test fails (or has previously failed while working on this branch), its results can be found in the following URLs:

Deployed to Azure Blob Storage: pr-5826

If the changes are expected, update the current_golden_images_cache hash in the circleci config to accept the new images. Instructions are included in that file.
If the changes are unexpected, you can investigate the cause of the differences and update the code accordingly.

@github-actions
Copy link
Contributor

Tachometer results

Currently, no packages are changed by this PR...

@coveralls
Copy link
Collaborator

coveralls commented Oct 24, 2025

Pull Request Test Coverage Report for Build 18777164984

Details

  • 9 of 9 (100.0%) changed or added relevant lines in 1 file are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.008%) to 97.958%

Files with Coverage Reduction New Missed Lines %
packages/menu/src/Menu.ts 2 93.82%
Totals Coverage Status
Change from base Build 18730825611: -0.008%
Covered Lines: 34248
Relevant Lines: 34779

💛 - Coveralls

@Rajdeepc Rajdeepc added the Status: WIP PR is a work in progress or draft label Oct 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Status: WIP PR is a work in progress or draft

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants