File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
packages/calcite-components/src/components/combobox Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -897,7 +897,7 @@ describe("calcite-combobox", () => {
897
897
expect ( await page . evaluate ( ( ) => document . activeElement . id ) ) . toBe ( "myCombobox" ) ;
898
898
} ) ;
899
899
900
- it ( `Space opens dropdown and puts focus on first item` , async ( ) => {
900
+ it ( `Space opens dropdown and puts focus on first item and subsequent Space do not change the focus ` , async ( ) => {
901
901
const inputEl = await page . find ( `#myCombobox >>> input` ) ;
902
902
await inputEl . focus ( ) ;
903
903
await page . waitForChanges ( ) ;
@@ -910,6 +910,12 @@ describe("calcite-combobox", () => {
910
910
911
911
const visible = await firstFocusedGroupItem . isVisible ( ) ;
912
912
expect ( visible ) . toBe ( true ) ;
913
+
914
+ await page . keyboard . press ( "Space" ) ;
915
+ await page . waitForChanges ( ) ;
916
+ await page . keyboard . press ( "Space" ) ;
917
+ await page . waitForChanges ( ) ;
918
+ expect ( firstFocusedGroupItem ) . toBeTruthy ( ) ;
913
919
} ) ;
914
920
915
921
it ( "when the combobox is focused & closed, Page up/down (fn arrow up/down) scrolls up and down the page" , async ( ) => {
Original file line number Diff line number Diff line change @@ -604,9 +604,11 @@ export class Combobox
604
604
break ;
605
605
case " " :
606
606
if ( ! this . textInput . value ) {
607
+ if ( ! this . open ) {
608
+ this . open = true ;
609
+ this . shiftActiveItemIndex ( 1 ) ;
610
+ }
607
611
event . preventDefault ( ) ;
608
- this . open = true ;
609
- this . shiftActiveItemIndex ( 1 ) ;
610
612
}
611
613
break ;
612
614
case "Home" :
You can’t perform that action at this time.
0 commit comments