Skip to content

Commit

Permalink
fix: Update Select to open with spacebar (#3006)
Browse files Browse the repository at this point in the history
Fixes: #3007

[category:Components]

Co-authored-by: manuel.carrera <[email protected]>
Co-authored-by: @NicholasBoll <[email protected]>
  • Loading branch information
3 people authored Oct 28, 2024
1 parent f4b6ec4 commit db213f0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
13 changes: 12 additions & 1 deletion cypress/integration/Select.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,17 @@ describe('Select', () => {
cy.findByText('Selected Value: Phone');
});
});

context('when spacebar is types and no value exists', () => {
beforeEach(() => {
cy.findByRole('combobox').focus();
cy.focused().realType(' ');
});
it('should select phone and the selected value should be visible', () => {
// should open the menu
cy.findByRole('listbox').should('exist');
});
});
});

context('given the "Disabled Options" story with a disabled option', () => {
Expand Down Expand Up @@ -421,7 +432,7 @@ describe('Select', () => {
});
});

context.only(`given the "Ref Forwarding" story is rendered`, () => {
context(`given the "Ref Forwarding" story is rendered`, () => {
beforeEach(() => {
h.stories.load('Components/Inputs/Select', 'Ref Forwarding');
});
Expand Down
4 changes: 2 additions & 2 deletions modules/react/select/lib/hooks/useSelectInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ function noop() {
*/
export const useSelectInput = composeHooks(
useComboboxInput,
useComboboxKeyboardTypeAhead,
useComboboxResetCursorToSelected,
useComboboxMoveCursorToSelected,
createElemPropsHook(useSelectModel)(
Expand Down Expand Up @@ -190,5 +189,6 @@ export const useSelectInput = composeHooks(
'aria-haspopup': 'menu',
} as const;
}
)
),
useComboboxKeyboardTypeAhead
);

0 comments on commit db213f0

Please sign in to comment.