Skip to content

Commit 98c5c88

Browse files
committed
fix(uui-combobox): Add open functionality with space bar
1 parent 7bc6ab9 commit 98c5c88

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

packages/uui-combobox-list/lib/uui-combobox-list.element.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,16 @@ export class UUIComboboxListElement extends LitElement {
239239
break;
240240
}
241241

242+
//Space key
243+
case ' ': {
244+
const el = e.target as HTMLInputElement;
245+
console.log('FROM LIST', el.value);
246+
e.preventDefault();
247+
e.stopPropagation();
248+
this._getActiveElement?.click();
249+
break;
250+
}
251+
242252
case 'End': {
243253
e.preventDefault();
244254
this._goToIndex(this._options.length - 1);

packages/uui-combobox/lib/uui-combobox.element.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,13 @@ export class UUIComboboxElement extends UUIFormControlMixin(LitElement, '') {
307307
this.#onOpen();
308308
}
309309

310+
if (e.key === ' ') {
311+
if (this._isOpen) return;
312+
e.preventDefault();
313+
e.stopImmediatePropagation();
314+
this.#onOpen();
315+
}
316+
310317
if (e.key === 'Escape' || e.key === 'Enter') {
311318
this.#onClose();
312319
}

0 commit comments

Comments
 (0)