Skip to content

fix(useSelect): ignore repeated Space activation - #1703

Open
feritcemkahraman wants to merge 1 commit into
downshift-js:masterfrom
feritcemkahraman:fix/select-repeated-space
Open

feritcemkahraman wants to merge 1 commit into
downshift-js:masterfrom
feritcemkahraman:fix/select-repeated-space

Conversation

@feritcemkahraman

Copy link
Copy Markdown

Pull Request

What

Prevent held Space from toggling a useSelect menu repeatedly. Related: #1197.

Why

When a user holds Space while choosing an item, the first keydown selects it and closes the menu; a repeated keydown immediately opens it again. Holding Space while opening can also immediately select an item.

How

Ignore repeated Space activation when there is no typeahead query; retain repeated spaces within a query.

Changes

  • Add regression tests for both opening and selection, plus typeahead behavior.
  • kcd-scripts test --runInBand --watch=false --coverage: 1,113 tests and 49 snapshots passed; reported coverage 100%.
  • Firefox and Chromium: the built change kept a button-based menu closed after a repeated Space selection. The published 9.4.0 build reopened it in Firefox.
  • The project TypeScript check encountered three TS2742 inferred declaration errors under pnpm; a no-declaration type check passed with locally linked Node types. The normal lint command could not load react-hooks/refs under this installation; changed files passed with that rule disabled (four existing warnings). The web bundle was generated, but its declaration phase reported the same TypeScript errors.

Codex assisted with investigation, implementation, and tests.

Checklist

  • Documentation
  • Tests
  • TypeScript Types
  • Ready to be merged

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.

1 participant