From 1d84695fb0222e8df823deea3147c8efc7f68460 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Bosi?= <71827178+bosiraphael@users.noreply.github.com> Date: Thu, 28 May 2026 21:23:40 +0200 Subject: [PATCH] Fix: focus stack overwritten when auto-opening title cell on new record (#21029) Fixes https://github.com/twentyhq/twenty/issues/20894 In `PageChangeEffect` `resetFocusStackToFocusItem` ran right after `openNewRecordTitleCell`, wiping the title cell entry. Typing in the auto-opened breadcrumb input (e.g. new workflow) triggered global shortcuts and ignored Enter / Escape / Tab. Reordered so the page reset runs first, then the title cell push lands on top. ## Before https://github.com/user-attachments/assets/d3c0c266-a493-46b8-b99b-32f4381b8664 ## After https://github.com/user-attachments/assets/3a886386-f438-46d2-a6ea-9ee6908d6df2 --- .../effect-components/PageChangeEffect.tsx | 37 +++++++++---------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/packages/twenty-front/src/modules/app/effect-components/PageChangeEffect.tsx b/packages/twenty-front/src/modules/app/effect-components/PageChangeEffect.tsx index c76d18b8b6..2ba2ab3822 100644 --- a/packages/twenty-front/src/modules/app/effect-components/PageChangeEffect.tsx +++ b/packages/twenty-front/src/modules/app/effect-components/PageChangeEffect.tsx @@ -224,6 +224,23 @@ export const PageChangeEffect = () => { } case isMatchingLocation(location, AppPath.RecordShowPage): { const isNewRecord = location.state?.isNewRecord === true; + const isSidePanelOpen = store.get(isSidePanelOpenedState.atom); + + if (!isSidePanelOpen) { + resetFocusStackToFocusItem({ + focusStackItem: { + focusId: PageFocusId.RecordShowPage, + componentInstance: { + componentType: FocusComponentType.PAGE, + componentInstanceId: PageFocusId.RecordShowPage, + }, + globalHotkeysConfig: { + enableGlobalHotkeysWithModifiers: true, + enableGlobalHotkeysConflictingWithKeyboard: true, + }, + }, + }); + } if ( isNewRecord && @@ -234,26 +251,6 @@ export const PageChangeEffect = () => { fieldName: location.state.labelIdentifierFieldName, }); } - - const isSidePanelOpen = store.get(isSidePanelOpenedState.atom); - - if (isSidePanelOpen) { - return; - } - - resetFocusStackToFocusItem({ - focusStackItem: { - focusId: PageFocusId.RecordShowPage, - componentInstance: { - componentType: FocusComponentType.PAGE, - componentInstanceId: PageFocusId.RecordShowPage, - }, - globalHotkeysConfig: { - enableGlobalHotkeysWithModifiers: true, - enableGlobalHotkeysConflictingWithKeyboard: true, - }, - }, - }); break; } case isMatchingLocation(location, AppPath.SignInUp): {