The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
fix: prevent command menu from closing when clicking items in slash menu (#12555)
Naifercb5a895963c1
diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuOpenContainer.tsx b/packages/twenty-front/src/modules/command-menu/components/CommandMenuOpenContainer.tsxindex 3cabd0b7831..06711cdb293 100644--- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuOpenContainer.tsx+++ b/packages/twenty-front/src/modules/command-menu/components/CommandMenuOpenContainer.tsx@@ -4,6 +4,7 @@ import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu';import { CommandMenuAnimationVariant } from '@/command-menu/types/CommandMenuAnimationVariant';import { CommandMenuHotkeyScope } from '@/command-menu/types/CommandMenuHotkeyScope';import { RECORD_CHIP_CLICK_OUTSIDE_ID } from '@/object-record/record-table/constants/RecordChipClickOutsideId';+import { SLASH_MENU_DROPDOWN_CLICK_OUTSIDE_ID } from '@/ui/input/constants/SlashMenuDropdownClickOutsideId';import { RootStackingContextZIndices } from '@/ui/layout/constants/RootStackingContextZIndices';import { PAGE_HEADER_COMMAND_MENU_BUTTON_CLICK_OUTSIDE_ID } from '@/ui/layout/page-header/constants/PageHeaderCommandMenuButtonClickOutsideId';import { currentHotkeyScopeState } from '@/ui/utilities/hotkey/states/internal/currentHotkeyScopeState';@@ -70,6 +71,7 @@ export const CommandMenuOpenContainer = ({PAGE_HEADER_COMMAND_MENU_BUTTON_CLICK_OUTSIDE_ID,LINK_CHIP_CLICK_OUTSIDE_ID,RECORD_CHIP_CLICK_OUTSIDE_ID,+ SLASH_MENU_DROPDOWN_CLICK_OUTSIDE_ID,],});diff --git a/packages/twenty-front/src/modules/ui/input/constants/SlashMenuDropdownClickOutsideId.ts b/packages/twenty-front/src/modules/ui/input/constants/SlashMenuDropdownClickOutsideId.tsnew file mode 100644index 00000000000..46440fde2b8--- /dev/null+++ b/packages/twenty-front/src/modules/ui/input/constants/SlashMenuDropdownClickOutsideId.ts@@ -0,0 +1,2 @@+export const SLASH_MENU_DROPDOWN_CLICK_OUTSIDE_ID =+ 'slash-menu-dropdown-click-outside-id';diff --git a/packages/twenty-front/src/modules/ui/input/editor/components/CustomSlashMenu.tsx b/packages/twenty-front/src/modules/ui/input/editor/components/CustomSlashMenu.tsxindex 2002b9bbd3a..aa360c8bc65 100644--- a/packages/twenty-front/src/modules/ui/input/editor/components/CustomSlashMenu.tsx+++ b/packages/twenty-front/src/modules/ui/input/editor/components/CustomSlashMenu.tsx@@ -1,6 +1,7 @@import type { SuggestionMenuProps } from '@blocknote/react';import styled from '@emotion/styled';+import { SLASH_MENU_DROPDOWN_CLICK_OUTSIDE_ID } from '@/ui/input/constants/SlashMenuDropdownClickOutsideId';import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent';import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer';import { OverlayContainer } from '@/ui/layout/overlay/components/OverlayContainer';@@ -44,7 +45,11 @@ export const CustomSlashMenu = (props: CustomSlashMenuProps) => {animate={{ opacity: 1 }}transition={{ duration: 0.1 }}>- <OverlayContainer ref={refs.setFloating} style={floatingStyles}>+ <OverlayContainer+ ref={refs.setFloating}+ style={floatingStyles}+ data-click-outside-id={SLASH_MENU_DROPDOWN_CLICK_OUTSIDE_ID}+ ><StyledInnerContainer><DropdownContent><DropdownMenuItemsContainer>