fix(editor): filterableList - prevent undefined item selection in keyboard nav (#12818)
Fixes error in FilterableList when pressing Enter on empty search results.  <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Bug Fixes** - Resolved an issue where pressing Enter could cause errors if no item was focused in filterable lists. Now, selection only occurs when a valid item is focused. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -111,6 +111,7 @@ export class FilterableListComponent<Props = unknown> extends WithDisposable(
|
|||||||
if (ev.isComposing) break;
|
if (ev.isComposing) break;
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
const item = filteredItems[this._curFocusIndex];
|
const item = filteredItems[this._curFocusIndex];
|
||||||
|
if (!item) return;
|
||||||
this._select(item);
|
this._select(item);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user