From 1fb68e3933e8e4cf0f6dec9ada84738a74e01a34 Mon Sep 17 00:00:00 2001 From: Aadi <123532141+golok727@users.noreply.github.com> Date: Mon, 16 Jun 2025 15:35:49 +0530 Subject: [PATCH] fix(editor): filterableList - prevent undefined item selection in keyboard nav (#12818) Fixes error in FilterableList when pressing Enter on empty search results. ![image](https://github.com/user-attachments/assets/3929c7ab-b20e-40d9-bc3d-808762ada8f3) ## 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. --- blocksuite/affine/components/src/filterable-list/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/blocksuite/affine/components/src/filterable-list/index.ts b/blocksuite/affine/components/src/filterable-list/index.ts index ccdb25eb3..ba77b7477 100644 --- a/blocksuite/affine/components/src/filterable-list/index.ts +++ b/blocksuite/affine/components/src/filterable-list/index.ts @@ -111,6 +111,7 @@ export class FilterableListComponent extends WithDisposable( if (ev.isComposing) break; ev.preventDefault(); const item = filteredItems[this._curFocusIndex]; + if (!item) return; this._select(item); break; }