Skip to content

Commit

Permalink
Merge branch 'master' into babel-runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
JedWatson authored Feb 4, 2021
2 parents 3fd3b8e + d48fafa commit a496e40
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/eighty-lemons-happen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"react-select": patch
---

Fix finding focusable options for groups
10 changes: 10 additions & 0 deletions cypress/integration/single-select.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,16 @@ describe('Single Select', () => {
.get(selector.focusedOption)
.should('exist');
});

it(`Should focus next option on down arrow key press after filtering: ${viewport}`, () => {
cy.get(selector.singleGroupedSelect)
.click()
.find('input')
.type('o', { force: true })
.type('{downarrow}', { force: true })
.get(selector.focusedOption)
.should('exist');
});
});

context(`Clearable in view: ${viewport}`, () => {
Expand Down
4 changes: 3 additions & 1 deletion packages/react-select/src/Select.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,9 @@ function buildFocusableOptionsFromCategorizedOptions(
) {
return categorizedOptions.reduce((optionsAccumulator, categorizedOption) => {
if (categorizedOption.type === 'group') {
optionsAccumulator.push(...categorizedOption.data.options);
optionsAccumulator.push(
...categorizedOption.options.map(option => option.data)
);
} else {
optionsAccumulator.push(categorizedOption.data);
}
Expand Down

0 comments on commit a496e40

Please sign in to comment.