Fixes on side panel closing and table rows and board cards activation (#12609)

Fixes https://github.com/twentyhq/core-team-issues/issues/1096

This PR:
- Prevents interaction with elements inside the index page when the side
panel is opened, except for switching between records
- Prevents stacking multiple records in the side panel navigation stack
when navigating from the index
- Adds activation and unfocus logic for board cards when clicked
- Fixes table row activation after clicking on a record chip

Before:


https://github.com/user-attachments/assets/dcfec9fb-392b-4760-9b11-b0f077087b82


After:


https://github.com/user-attachments/assets/93e0dc6a-c693-4484-b23e-f5ae291eb472
This commit is contained in:
Raphaël Bosi
2025-06-16 10:33:57 +02:00
committed by GitHub
parent 46d6e7a8bc
commit 6d6738e7cb
6 changed files with 48 additions and 11 deletions

View File

@ -51,12 +51,14 @@ export const CommandMenuOpenContainer = ({
const handleClickOutside = useRecoilCallback(
({ snapshot }) =>
() => {
(event: MouseEvent | TouchEvent) => {
const hotkeyScope = snapshot
.getLoadable(currentHotkeyScopeState)
.getValue();
if (hotkeyScope?.scope === CommandMenuHotkeyScope.CommandMenuFocused) {
event.stopImmediatePropagation();
event.preventDefault();
closeCommandMenu();
}
},

View File

@ -38,10 +38,12 @@ export const useOpenRecordInCommandMenu = () => {
recordId,
objectNameSingular,
isNewRecord = false,
resetNavigationStack = false,
}: {
recordId: string;
objectNameSingular: string;
isNewRecord?: boolean;
resetNavigationStack?: boolean;
}) => {
const navigationStack = getSnapshotValue(
snapshot,
@ -171,7 +173,7 @@ export const useOpenRecordInCommandMenu = () => {
pageIcon: Icon,
pageIconColor: IconColor,
pageId: pageComponentInstanceId,
resetNavigationStack: false,
resetNavigationStack,
});
if (objectNameSingular === CoreObjectNameSingular.WorkflowRun) {