mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-27 02:42:25 +08:00
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;
|
||||
ev.preventDefault();
|
||||
const item = filteredItems[this._curFocusIndex];
|
||||
if (!item) return;
|
||||
this._select(item);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user