File tree Expand file tree Collapse file tree 4 files changed +24
-14
lines changed Expand file tree Collapse file tree 4 files changed +24
-14
lines changed Original file line number Diff line number Diff line change @@ -71,13 +71,15 @@ type KeyDownNoFiltersEvents =
7171 | typeof KEY_CODES . HOME
7272 | typeof KEY_CODES . END
7373 | typeof KEY_CODES . ENTER
74+ | typeof KEY_CODES . NUMPAD_ENTER
7475 | typeof KEY_CODES . SPACE
7576 | typeof KEY_CODES . TAB ;
7677
7778type KeyDownWithFiltersEvents =
7879 | typeof KEY_CODES . ARROW_UP
7980 | typeof KEY_CODES . ARROW_DOWN
8081 | typeof KEY_CODES . ENTER
82+ | typeof KEY_CODES . NUMPAD_ENTER
8183 | typeof KEY_CODES . TAB ;
8284
8385/**
@@ -231,6 +233,16 @@ export class ChComboBoxRender
231233 this . expanded = ! this . expanded ;
232234 } ,
233235
236+ // Same as the Enter handler
237+ NumpadEnter : ( ) => {
238+ // The focus must return to the Host when closing the popover
239+ if ( this . expanded ) {
240+ this . #shouldFocusTheComboBox = true ;
241+ }
242+
243+ this . expanded = ! this . expanded ;
244+ } ,
245+
234246 Space : event => {
235247 event . preventDefault ( ) ; // Stop space key from scrolling
236248
@@ -273,6 +285,10 @@ export class ChComboBoxRender
273285 Enter : ( event : KeyboardEvent ) =>
274286 this . #checkAndEmitValueChangeWithFilters( event ) ,
275287
288+ // Same as the Enter handler
289+ NumpadEnter : ( event : KeyboardEvent ) =>
290+ this . #checkAndEmitValueChangeWithFilters( event ) ,
291+
276292 Tab : ( event : KeyboardEvent ) =>
277293 this . #checkAndEmitValueChangeWithFilters( event )
278294 } ;
Original file line number Diff line number Diff line change @@ -392,8 +392,7 @@ const keysToConfirmClose: ConfirmKeys[] = [
392392 "Enter" ,
393393 // "Escape",
394394
395- // TODO: Fix this test
396- // "NumpadEnter",
395+ "NumpadEnter" ,
397396
398397 "Tab" ,
399398 "LeftMouseClick"
Original file line number Diff line number Diff line change @@ -453,8 +453,7 @@ const keysToConfirmClose: ConfirmKeys[] = [
453453 // TODO: Fix this test
454454 // "Escape",
455455
456- // TODO: Fix this test
457- // "NumpadEnter",
456+ "NumpadEnter" ,
458457
459458 "Tab" ,
460459 "LeftMouseClick"
Original file line number Diff line number Diff line change @@ -43,18 +43,14 @@ const SUGGEST_KEYS_TO_NOT_OPEN: KeyToPress[] = [
4343 "Tab"
4444] ;
4545
46- const COMBO_BOX_KEYS_TO_OPEN : KeyToPress [ ] = [
47- "Space" ,
48- "Enter"
49- // "NumpadEnter"
50- ] ;
46+ const COMBO_BOX_KEYS_TO_OPEN : KeyToPress [ ] = [ "Space" , "Enter" , "NumpadEnter" ] ;
5147const SUGGEST_KEYS_TO_OPEN : KeyToPress [ ] = [
5248 // TODO: Fix $0.focus() to fix these tests
5349 // "ArrowDown",
5450 // "ArrowUp",
5551 "Space" ,
56- "Enter"
57- // "NumpadEnter"
52+ "Enter" ,
53+ "NumpadEnter"
5854] ;
5955
6056const COMBO_BOX_KEYS_TO_NOT_CLOSE : KeyToPress [ ] = [
@@ -69,16 +65,16 @@ const COMBO_BOX_KEYS_TO_NOT_CLOSE: KeyToPress[] = [
6965const COMBO_BOX_KEYS_TO_CLOSE : KeyToPress [ ] = [
7066 "Enter" ,
7167 "Escape" ,
72- // "NumpadEnter",
68+ "NumpadEnter" ,
7369 "Tab"
7470] ;
7571
7672const COMBO_BOX_KEYS_TO_CLOSE_AND_RETURN_FOCUS : KeyToPress [ ] = [
7773 // TODO: Fix these tests
7874 "Enter" ,
7975 "Escape" ,
80- "Tab"
81- // "NumpadEnter"
76+ "Tab" ,
77+ "NumpadEnter"
8278] ;
8379
8480const STRICT_FILTERS : ComboBoxSuggestOptions = { strict : true } ;
You can’t perform that action at this time.
0 commit comments