Skip to content

fix(combobox): Fix Space key selection for select-only comboboxes#3398

Merged
michal-sanoma merged 3 commits into
mainfrom
fix/3053_combobox_spacebar
Jun 2, 2026
Merged

fix(combobox): Fix Space key selection for select-only comboboxes#3398
michal-sanoma merged 3 commits into
mainfrom
fix/3053_combobox_spacebar

Conversation

@michal-sanoma
Copy link
Copy Markdown
Collaborator

@michal-sanoma michal-sanoma commented Jun 1, 2026

Summary

  • Allow select-only comboboxes to select and deselect the current option with the Space key
  • Keep existing editable combobox behavior unchanged, so Space still inserts a space in the input field
  • Add regression tests for single-select, multi-select, and editable combobox behavior

BEFORE

before.mov

AFTER

after.mov

@michal-sanoma michal-sanoma self-assigned this Jun 1, 2026
Copilot AI review requested due to automatic review settings June 1, 2026 05:58
@michal-sanoma michal-sanoma added the bug Something isn't working label Jun 1, 2026
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jun 1, 2026

🦋 Changeset detected

Latest commit: aa8624a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sl-design-system/combobox Patch

Not sure what this means? Click here to learn what changesets are.

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

Copy link
Copy Markdown
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 fixes keyboard interaction for select-only comboboxes by enabling the Space key to toggle selection of the currently highlighted option, while preserving the existing behavior for editable comboboxes (Space inserts a space into the input).

Changes:

  • Treat Space as a selection toggle key for select-only comboboxes (in addition to Enter), including preventing default Space behavior.
  • Add regression tests covering editable (space insertion), single-select select-only (space toggles), and multi-select select-only (space toggles).
  • Add a changeset to publish the fix as a patch for @sl-design-system/combobox.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
packages/components/combobox/src/combobox.ts Adds select-only Space-key handling to toggle the current option selection.
packages/components/combobox/src/combobox.spec.ts Adds regression tests for Space behavior in editable, single-select select-only, and multi-select select-only modes.
.changeset/quiet-spaces-select.md Documents and versions the fix as a patch release.

Comment thread packages/components/combobox/src/combobox.ts Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 1, 2026 06:05
Copy link
Copy Markdown
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

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

@a11ymiko a11ymiko marked this pull request as ready for review June 1, 2026 10:24
@michal-sanoma michal-sanoma linked an issue Jun 2, 2026 that may be closed by this pull request
Comment thread packages/components/combobox/src/combobox.ts Outdated
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 2, 2026

@michal-sanoma michal-sanoma merged commit 0b948e2 into main Jun 2, 2026
13 checks passed
@michal-sanoma michal-sanoma deleted the fix/3053_combobox_spacebar branch June 2, 2026 12:15
@github-actions github-actions Bot mentioned this pull request Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Combobox] Spacebar cannot be used to select and deselect options

5 participants