The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Fix twenty-ui checks after the Base UI 1.9.0 update (#28191)
Raphaël Bosi63b9e7dc5fbd
diff --git a/packages/twenty-docs/snippets/ui/generated/input/autocomplete.mdx b/packages/twenty-docs/snippets/ui/generated/input/autocomplete.mdxindex d7c87e0c58e..10f0856d1a2 100644--- a/packages/twenty-docs/snippets/ui/generated/input/autocomplete.mdx+++ b/packages/twenty-docs/snippets/ui/generated/input/autocomplete.mdx@@ -15,8 +15,10 @@<ParamField body="Root.actionsRef" type="RefObject<AutocompleteRootActions | null>">A ref to imperative actions.- - `unmount`: Manually unmounts the autocomplete.- Call this after any externally controlled closing animation finishes.+ - `unmount`: Ends the closing phase of the autocomplete after an externally controlled closing animation finishes.+ Call `preventUnmountOnClose()` in `onOpenChange` first, otherwise the autocomplete completes closing on its own.+ Whether it leaves the DOM is decided by `keepMounted` on the portal.+ - `close`: Closes the autocomplete imperatively when called.</ParamField><ParamField body="Root.autoHighlight" type="boolean | "always"" default="false">@@ -136,11 +138,13 @@Receives the highlighted item value (or `undefined` if no item is highlighted) and event details with a `reason` property describing why the highlight changed.The `reason` can be:- `'keyboard'`: the highlight changed due to keyboard navigation.- - `'pointer'`: the highlight changed due to pointer hovering.- - `'none'`: the highlight changed programmatically.+ - `'pointer'`: the highlight changed due to pointer hovering. The event may be a `MouseEvent`+ rather than a `PointerEvent`.+ - `'none'`: the highlight changed for another reason, such as typing, `autoHighlight`, the+ item list changing, or the popup opening or closing.</ParamField>-<ParamField body="Root.onOpenChange" type="((open: boolean, eventDetails: AutocompleteRootChangeEventDetails) => void)">+<ParamField body="Root.onOpenChange" type="((open: boolean, eventDetails: AutocompleteRootOpenChangeEventDetails) => void)">Event handler called when the popup is opened or closed.</ParamField>diff --git a/packages/twenty-docs/snippets/ui/generated/input/select.mdx b/packages/twenty-docs/snippets/ui/generated/input/select.mdxindex a224029fda6..55ca04e06d9 100644--- a/packages/twenty-docs/snippets/ui/generated/input/select.mdx+++ b/packages/twenty-docs/snippets/ui/generated/input/select.mdx@@ -15,8 +15,10 @@<ParamField body="Root.actionsRef" type="RefObject<SelectRootActions | null>">A ref to imperative actions.- - `unmount`: Manually unmounts the select.- Call this after any externally controlled closing animation finishes.+ - `unmount`: Ends the closing phase of the select after an externally controlled closing animation finishes.+ Call `preventUnmountOnClose()` in `onOpenChange` first, otherwise the select completes closing on its own.+ Whether it leaves the DOM is decided by `keepMounted` on the portal.+ - `close`: Closes the select imperatively when called.</ParamField><ParamField body="Root.autoComplete" type="string">@@ -33,7 +35,7 @@To render a controlled select popup, use the `open` prop instead.</ParamField>-<ParamField body="Root.defaultValue" type="SelectValueType<Value, Multiple> | null">+<ParamField body="Root.defaultValue" type="SelectInputValue<Value, Multiple> | null">The uncontrolled value of the select when it's initially rendered.To render a controlled select, use the `value` prop instead.@@ -97,7 +99,7 @@Identifies the field when a form is submitted.</ParamField>-<ParamField body="Root.onOpenChange" type="((open: boolean, eventDetails: SelectRootChangeEventDetails) => void)">+<ParamField body="Root.onOpenChange" type="((open: boolean, eventDetails: SelectRootOpenChangeEventDetails) => void)">Receives the requested open state and unchanged Base UI event details.</ParamField>@@ -105,7 +107,7 @@Event handler called after any animations complete when the select popup is opened or closed.</ParamField>-<ParamField body="Root.onValueChange" type="((value: SelectValueType<Value, Multiple> | (Multiple extends true ? never : null), eventDetails: SelectRootChangeEventDetails) => void)">+<ParamField body="Root.onValueChange" type="((value: SelectOutputValue<Value, Multiple> | (Multiple extends true ? never : null), eventDetails: SelectRootChangeEventDetails) => void)">Receives the requested generic value and unchanged Base UI event details, including reason, event and cancel(). Multiple selection receives an array; a cleared single value is null.</ParamField>@@ -121,7 +123,7 @@Whether the user must choose a value before submitting a form.</ParamField>-<ParamField body="Root.value" type="SelectValueType<Value, Multiple> | null">+<ParamField body="Root.value" type="SelectInputValue<Value, Multiple> | null">The value of the select. Use when controlled.</ParamField>diff --git a/packages/twenty-docs/snippets/ui/generated/surfaces/alert-dialog.mdx b/packages/twenty-docs/snippets/ui/generated/surfaces/alert-dialog.mdxindex 53265e325c0..08b79f18b5a 100644--- a/packages/twenty-docs/snippets/ui/generated/surfaces/alert-dialog.mdx+++ b/packages/twenty-docs/snippets/ui/generated/surfaces/alert-dialog.mdx@@ -15,8 +15,9 @@<ParamField body="Root.actionsRef" type="RefObject<DialogRootActions | null>">A ref to imperative actions.- - `unmount`: Manually unmounts the alert dialog.- Call this after any externally controlled closing animation finishes.+ - `unmount`: Ends the closing phase of the alert dialog after an externally controlled closing animation finishes.+ Call `preventUnmountOnClose()` in `onOpenChange` first, otherwise the alert dialog completes closing on its own.+ Whether it leaves the DOM is decided by `keepMounted` on the portal.- `close`: Closes the alert dialog imperatively when called.</ParamField>diff --git a/packages/twenty-docs/snippets/ui/generated/surfaces/dialog.mdx b/packages/twenty-docs/snippets/ui/generated/surfaces/dialog.mdxindex 892163a39cc..3dcaf275351 100644--- a/packages/twenty-docs/snippets/ui/generated/surfaces/dialog.mdx+++ b/packages/twenty-docs/snippets/ui/generated/surfaces/dialog.mdx@@ -15,8 +15,9 @@<ParamField body="Root.actionsRef" type="RefObject<DialogRootActions | null>">A ref to imperative actions.- - `unmount`: Manually unmounts the dialog.- Call this after any externally controlled closing animation finishes.+ - `unmount`: Ends the closing phase of the dialog after an externally controlled closing animation finishes.+ Call `preventUnmountOnClose()` in `onOpenChange` first, otherwise the dialog completes closing on its own.+ Whether it leaves the DOM is decided by `keepMounted` on the portal.- `close`: Closes the dialog imperatively when called.</ParamField>diff --git a/packages/twenty-docs/snippets/ui/generated/surfaces/popover.mdx b/packages/twenty-docs/snippets/ui/generated/surfaces/popover.mdxindex 6c81285c120..5caacb736fc 100644--- a/packages/twenty-docs/snippets/ui/generated/surfaces/popover.mdx+++ b/packages/twenty-docs/snippets/ui/generated/surfaces/popover.mdx@@ -15,8 +15,9 @@<ParamField body="Root.actionsRef" type="RefObject<PopoverRootActions | null>">A ref to imperative actions.- - `unmount`: Manually unmounts the popover.- Call this after any externally controlled closing animation finishes.+ - `unmount`: Ends the closing phase of the popover after an externally controlled closing animation finishes.+ Call `preventUnmountOnClose()` in `onOpenChange` first, otherwise the popover completes closing on its own.+ Whether it leaves the DOM is decided by `keepMounted` on the portal.- `close`: Closes the popover imperatively when called.</ParamField>diff --git a/packages/twenty-docs/snippets/ui/generated/surfaces/tooltip.mdx b/packages/twenty-docs/snippets/ui/generated/surfaces/tooltip.mdxindex 55c9ce9f28b..be49f618699 100644--- a/packages/twenty-docs/snippets/ui/generated/surfaces/tooltip.mdx+++ b/packages/twenty-docs/snippets/ui/generated/surfaces/tooltip.mdx@@ -13,7 +13,9 @@<ParamField body="actionsRef" type="RefObject<TooltipRootActions | null>">A ref to imperative actions.- - `unmount`: Unmounts the tooltip popup.+ - `unmount`: Ends the closing phase of the tooltip after an externally controlled closing animation finishes.+ Call `preventUnmountOnClose()` in `onOpenChange` first, otherwise the tooltip completes closing on its own.+ Whether it leaves the DOM is decided by `keepMounted` on the portal.- `close`: Closes the tooltip imperatively when called.</ParamField>@@ -216,7 +218,9 @@<ParamField body="Root.actionsRef" type="RefObject<TooltipRootActions | null>">A ref to imperative actions.- - `unmount`: Unmounts the tooltip popup.+ - `unmount`: Ends the closing phase of the tooltip after an externally controlled closing animation finishes.+ Call `preventUnmountOnClose()` in `onOpenChange` first, otherwise the tooltip completes closing on its own.+ Whether it leaves the DOM is decided by `keepMounted` on the portal.- `close`: Closes the tooltip imperatively when called.</ParamField>diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/collapsibleTest.ts b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/collapsibleTest.tsindex d2a4acc7333..a86fff79815 100644--- a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/collapsibleTest.ts+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/collapsibleTest.ts@@ -74,7 +74,7 @@ export const collapsibleTest: TwentyUiGalleryPlayFunction = async ({expect(uncontrolled).toHaveAttribute('aria-expanded', 'true');const disabled = canvas.getByRole('button', { name: 'Disabled details' });- expect(disabled).toHaveAttribute('aria-disabled', 'true');+ expect(disabled).toBeDisabled();await userEvent.click(disabled);expect(disabled).toHaveAttribute('aria-expanded', 'false');expect(diff --git a/packages/twenty-ui/.size-limit.json b/packages/twenty-ui/.size-limit.jsonindex 3c490a4b980..4d6fd482be5 100644--- a/packages/twenty-ui/.size-limit.json+++ b/packages/twenty-ui/.size-limit.json@@ -13,7 +13,7 @@{"name": "components","path": "dist/components.mjs",- "limit": "150 kB"+ "limit": "160 kB"},{"name": "components/code-editor",diff --git a/packages/twenty-ui/generated/components.docs.json b/packages/twenty-ui/generated/components.docs.jsonindex 922fb78b599..db75c90a804 100644--- a/packages/twenty-ui/generated/components.docs.json+++ b/packages/twenty-ui/generated/components.docs.json@@ -4446,7 +4446,7 @@"type": "RefObject<AutocompleteRootActions | null>","required": false,"defaultValue": null,- "description": "A ref to imperative actions.\n- `unmount`: Manually unmounts the autocomplete.\nCall this after any externally controlled closing animation finishes."+ "description": "A ref to imperative actions.\n- `unmount`: Ends the closing phase of the autocomplete after an externally controlled closing animation finishes.\nCall `preventUnmountOnClose()` in `onOpenChange` first, otherwise the autocomplete completes closing on its own.\nWhether it leaves the DOM is decided by `keepMounted` on the portal.\n- `close`: Closes the autocomplete imperatively when called."},{"name": "autoHighlight",@@ -4600,11 +4600,11 @@"type": "(highlightedValue: TItem | undefined, eventDetails: AutocompleteRootHighlightEventDetails) => void","required": false,"defaultValue": null,- "description": "Callback fired when an item is highlighted or unhighlighted.\nReceives the highlighted item value (or `undefined` if no item is highlighted) and event details with a `reason` property describing why the highlight changed.\nThe `reason` can be:\n- `'keyboard'`: the highlight changed due to keyboard navigation.\n- `'pointer'`: the highlight changed due to pointer hovering.\n- `'none'`: the highlight changed programmatically."+ "description": "Callback fired when an item is highlighted or unhighlighted.\nReceives the highlighted item value (or `undefined` if no item is highlighted) and event details with a `reason` property describing why the highlight changed.\nThe `reason` can be:\n- `'keyboard'`: the highlight changed due to keyboard navigation.\n- `'pointer'`: the highlight changed due to pointer hovering. The event may be a `MouseEvent`\n rather than a `PointerEvent`.\n- `'none'`: the highlight changed for another reason, such as typing, `autoHighlight`, the\n item list changing, or the popup opening or closing."},{"name": "onOpenChange",- "type": "((open: boolean, eventDetails: AutocompleteRootChangeEventDetails) => void)",+ "type": "((open: boolean, eventDetails: AutocompleteRootOpenChangeEventDetails) => void)","required": false,"defaultValue": null,"description": "Event handler called when the popup is opened or closed."@@ -5434,7 +5434,7 @@"type": "RefObject<SelectRootActions | null>","required": false,"defaultValue": null,- "description": "A ref to imperative actions.\n- `unmount`: Manually unmounts the select.\nCall this after any externally controlled closing animation finishes."+ "description": "A ref to imperative actions.\n- `unmount`: Ends the closing phase of the select after an externally controlled closing animation finishes.\nCall `preventUnmountOnClose()` in `onOpenChange` first, otherwise the select completes closing on its own.\nWhether it leaves the DOM is decided by `keepMounted` on the portal.\n- `close`: Closes the select imperatively when called."},{"name": "autoComplete",@@ -5459,7 +5459,7 @@},{"name": "defaultValue",- "type": "SelectValueType<Value, Multiple> | null",+ "type": "SelectInputValue<Value, Multiple> | null","required": false,"defaultValue": null,"description": "The uncontrolled value of the select when it's initially rendered.\n\nTo render a controlled select, use the `value` prop instead."@@ -5550,7 +5550,7 @@},{"name": "onOpenChange",- "type": "((open: boolean, eventDetails: SelectRootChangeEventDetails) => void)",+ "type": "((open: boolean, eventDetails: SelectRootOpenChangeEventDetails) => void)","required": false,"defaultValue": null,"description": "Receives the requested open state and unchanged Base UI event details."@@ -5564,7 +5564,7 @@},{"name": "onValueChange",- "type": "((value: SelectValueType<Value, Multiple> | (Multiple extends true ? never : null), eventDetails: SelectRootChangeEventDetails) => void)",+ "type": "((value: SelectOutputValue<Value, Multiple> | (Multiple extends true ? never : null), eventDetails: SelectRootChangeEventDetails) => void)","required": false,"defaultValue": null,"description": "Receives the requested generic value and unchanged Base UI event details, including reason, event and cancel(). Multiple selection receives an array; a cleared single value is null."@@ -5592,7 +5592,7 @@},{"name": "value",- "type": "SelectValueType<Value, Multiple> | null",+ "type": "SelectInputValue<Value, Multiple> | null","required": false,"defaultValue": null,"description": "The value of the select. Use when controlled."@@ -7641,7 +7641,7 @@"type": "RefObject<DialogRootActions | null>","required": false,"defaultValue": null,- "description": "A ref to imperative actions.\n- `unmount`: Manually unmounts the dialog.\nCall this after any externally controlled closing animation finishes.\n- `close`: Closes the dialog imperatively when called."+ "description": "A ref to imperative actions.\n- `unmount`: Ends the closing phase of the dialog after an externally controlled closing animation finishes.\nCall `preventUnmountOnClose()` in `onOpenChange` first, otherwise the dialog completes closing on its own.\nWhether it leaves the DOM is decided by `keepMounted` on the portal.\n- `close`: Closes the dialog imperatively when called."},{"name": "children",@@ -8136,7 +8136,7 @@"type": "RefObject<DialogRootActions | null>","required": false,"defaultValue": null,- "description": "A ref to imperative actions.\n- `unmount`: Manually unmounts the alert dialog.\nCall this after any externally controlled closing animation finishes.\n- `close`: Closes the alert dialog imperatively when called."+ "description": "A ref to imperative actions.\n- `unmount`: Ends the closing phase of the alert dialog after an externally controlled closing animation finishes.\nCall `preventUnmountOnClose()` in `onOpenChange` first, otherwise the alert dialog completes closing on its own.\nWhether it leaves the DOM is decided by `keepMounted` on the portal.\n- `close`: Closes the alert dialog imperatively when called."},{"name": "children",@@ -8533,7 +8533,7 @@"type": "RefObject<PopoverRootActions | null>","required": false,"defaultValue": null,- "description": "A ref to imperative actions.\n- `unmount`: Manually unmounts the popover.\nCall this after any externally controlled closing animation finishes.\n- `close`: Closes the popover imperatively when called."+ "description": "A ref to imperative actions.\n- `unmount`: Ends the closing phase of the popover after an externally controlled closing animation finishes.\nCall `preventUnmountOnClose()` in `onOpenChange` first, otherwise the popover completes closing on its own.\nWhether it leaves the DOM is decided by `keepMounted` on the portal.\n- `close`: Closes the popover imperatively when called."},{"name": "children",@@ -9096,7 +9096,7 @@"type": "RefObject<TooltipRootActions | null>","required": false,"defaultValue": null,- "description": "A ref to imperative actions.\n- `unmount`: Unmounts the tooltip popup.\n- `close`: Closes the tooltip imperatively when called."+ "description": "A ref to imperative actions.\n- `unmount`: Ends the closing phase of the tooltip after an externally controlled closing animation finishes.\nCall `preventUnmountOnClose()` in `onOpenChange` first, otherwise the tooltip completes closing on its own.\nWhether it leaves the DOM is decided by `keepMounted` on the portal.\n- `close`: Closes the tooltip imperatively when called."},{"name": "align",@@ -9395,7 +9395,7 @@"type": "RefObject<TooltipRootActions | null>","required": false,"defaultValue": null,- "description": "A ref to imperative actions.\n- `unmount`: Unmounts the tooltip popup.\n- `close`: Closes the tooltip imperatively when called."+ "description": "A ref to imperative actions.\n- `unmount`: Ends the closing phase of the tooltip after an externally controlled closing animation finishes.\nCall `preventUnmountOnClose()` in `onOpenChange` first, otherwise the tooltip completes closing on its own.\nWhether it leaves the DOM is decided by `keepMounted` on the portal.\n- `close`: Closes the tooltip imperatively when called."},{"name": "children",diff --git a/packages/twenty-ui/src/components/navigation/Dropdown/__stories__/Dropdown.submenu.stories.tsx b/packages/twenty-ui/src/components/navigation/Dropdown/__stories__/Dropdown.submenu.stories.tsxindex f00f03aeeed..2b9c9289598 100644--- a/packages/twenty-ui/src/components/navigation/Dropdown/__stories__/Dropdown.submenu.stories.tsx+++ b/packages/twenty-ui/src/components/navigation/Dropdown/__stories__/Dropdown.submenu.stories.tsx@@ -1,5 +1,5 @@import { type Meta, type StoryObj } from '@storybook/react-vite';-import { expect, userEvent, waitFor, within } from 'storybook/test';+import { expect, fn, userEvent, waitFor, within } from 'storybook/test';import { Button } from '@ui/primitives/input/Button/Button';import { DirectionProvider } from '@ui/primitives/layout/DirectionProvider/DirectionProvider';@@ -32,6 +32,33 @@ const ExportSubmenuWithNextControl = () => (</>);+const onSpreadsheetOpenChange = fn();++const NestedSubmenusWithNextControl = () => (+ <>+ <Dropdown.Root type="menu">+ <Dropdown.Trigger>Record actions</Dropdown.Trigger>+ <Dropdown.Content aria-label="Record actions" keepMounted>+ <Dropdown.Submenu>+ <Dropdown.SubmenuTrigger delay={0}>Export</Dropdown.SubmenuTrigger>+ <Dropdown.Content aria-label="Export formats" keepMounted>+ <Dropdown.Submenu onOpenChange={onSpreadsheetOpenChange}>+ <Dropdown.SubmenuTrigger delay={0}>+ Spreadsheet+ </Dropdown.SubmenuTrigger>+ <Dropdown.Content aria-label="Spreadsheet formats" keepMounted>+ <Dropdown.ActionItem>CSV</Dropdown.ActionItem>+ <Dropdown.ActionItem>Excel</Dropdown.ActionItem>+ </Dropdown.Content>+ </Dropdown.Submenu>+ </Dropdown.Content>+ </Dropdown.Submenu>+ </Dropdown.Content>+ </Dropdown.Root>+ <Button>Next control</Button>+ </>+);+const focusExportTrigger = async (canvasElement: HTMLElement) => {const body = within(canvasElement.ownerDocument.body);@@ -224,3 +251,33 @@ export const ShiftTabClosesMenuChain: Story = {render: () => <ExportSubmenuWithNextControl />,play: playTabClosesMenuChain({ shift: true }),};++export const TabClosesNestedMenuChain: Story = {+ render: () => <NestedSubmenusWithNextControl />,+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);+ const body = within(canvasElement.ownerDocument.body);++ onSpreadsheetOpenChange.mockClear();+ await focusExportTrigger(canvasElement);+ await userEvent.keyboard('{ArrowRight}');+ await waitFor(() =>+ expect(body.getByRole('menuitem', { name: 'Spreadsheet' })).toHaveFocus(),+ );+ await userEvent.keyboard('{ArrowRight}');+ await waitFor(() =>+ expect(body.getByRole('menuitem', { name: 'CSV' })).toHaveFocus(),+ );+ await userEvent.tab();++ await waitFor(() =>+ expect(body.queryByRole('menu')).not.toBeInTheDocument(),+ );+ await waitFor(() =>+ expect(+ canvas.getByRole('button', { name: 'Next control' }),+ ).toHaveFocus(),+ );+ expect(onSpreadsheetOpenChange).toHaveBeenLastCalledWith(false);+ },+};diff --git a/packages/twenty-ui/src/components/navigation/Dropdown/internal/DropdownContextValue.ts b/packages/twenty-ui/src/components/navigation/Dropdown/internal/DropdownContextValue.tsindex 81140c972ef..1c084d3da32 100644--- a/packages/twenty-ui/src/components/navigation/Dropdown/internal/DropdownContextValue.ts+++ b/packages/twenty-ui/src/components/navigation/Dropdown/internal/DropdownContextValue.ts@@ -25,6 +25,10 @@ export type DropdownContextValue = {setFocusOnOpen: (focusOnOpen: boolean) => void;setOpen: (open: boolean) => void;closeTree: (tabOutEvent?: Event) => void;+ tabForwardOutOfTree: (tab: {+ ownerDocument: Document;+ tabOutEvent: Event;+ }) => void;goToPage: (page: { id: string; trigger?: DropdownFocusTarget }) => void;goBack: () => void;registerPage: (page: { id: string; type?: DropdownType }) => void;diff --git a/packages/twenty-ui/src/components/navigation/Dropdown/internal/DropdownRoot.tsx b/packages/twenty-ui/src/components/navigation/Dropdown/internal/DropdownRoot.tsxindex 6bbb5a6f3f5..3ee8f40f3a2 100644--- a/packages/twenty-ui/src/components/navigation/Dropdown/internal/DropdownRoot.tsx+++ b/packages/twenty-ui/src/components/navigation/Dropdown/internal/DropdownRoot.tsx@@ -11,6 +11,7 @@ import { type DropdownFocusTarget } from './DropdownFocusTarget';import { type DropdownPageFocusRequest } from './DropdownPageFocusRequest';import { DropdownNestedRootEffect } from './DropdownNestedRootEffect';import { getDropdownTabStopRowId } from './getDropdownTabStopRowId';+import { getTrailingFocusGuard } from './getTrailingFocusGuard';import { isDropdownDismissPrevented } from './isDropdownDismissPrevented';import { useRegisteredElementId } from './useRegisteredElementId';@@ -107,6 +108,34 @@ export const DropdownRoot = ({}};+ const tabForwardOutOfTree = ({+ ownerDocument,+ tabOutEvent,+ }: {+ ownerDocument: Document;+ tabOutEvent: Event;+ }) => {+ const triggerElement = isDefined(triggerId)+ ? ownerDocument.getElementById(triggerId)+ : null;++ if (isSubmenu && isDefined(parent)) {+ setOpen(false);+ triggerElement?.focus();+ parent.tabForwardOutOfTree({ ownerDocument, tabOutEvent });+ return;+ }++ const trailingFocusGuard = getTrailingFocusGuard(triggerElement);++ if (!isDefined(trailingFocusGuard)) {+ closeTree(tabOutEvent);+ return;+ }++ trailingFocusGuard.focus();+ };+const goToPage = ({id,trigger,@@ -155,6 +184,11 @@ export const DropdownRoot = ({<Popover.Rootopen={open}onOpenChange={(nextOpen, eventDetails) => {+ if (!nextOpen && !open) {+ eventDetails.cancel();+ return;+ }+const isOutsideDismissal =eventDetails.reason === 'outside-press' ||eventDetails.reason === 'focus-out';@@ -218,6 +252,7 @@ export const DropdownRoot = ({setFocusOnOpen,setOpen,closeTree,+ tabForwardOutOfTree,goToPage,goBack,registerPage,diff --git a/packages/twenty-ui/src/components/navigation/Dropdown/internal/getTrailingFocusGuard.ts b/packages/twenty-ui/src/components/navigation/Dropdown/internal/getTrailingFocusGuard.tsnew file mode 100644index 00000000000..2cb5591fbc0--- /dev/null+++ b/packages/twenty-ui/src/components/navigation/Dropdown/internal/getTrailingFocusGuard.ts@@ -0,0 +1,14 @@+const FOCUS_GUARD_ATTRIBUTE = 'data-base-ui-focus-guard';++export const getTrailingFocusGuard = (element: Element | null) => {+ const nextElement = element?.nextElementSibling;++ if (+ !(nextElement instanceof HTMLElement) ||+ !nextElement.hasAttribute(FOCUS_GUARD_ATTRIBUTE)+ ) {+ return undefined;+ }++ return nextElement;+};diff --git a/packages/twenty-ui/src/components/navigation/Dropdown/internal/useDropdownKeyboardNavigation.ts b/packages/twenty-ui/src/components/navigation/Dropdown/internal/useDropdownKeyboardNavigation.tsindex 1df1f97d2bb..14f56961f59 100644--- a/packages/twenty-ui/src/components/navigation/Dropdown/internal/useDropdownKeyboardNavigation.ts+++ b/packages/twenty-ui/src/components/navigation/Dropdown/internal/useDropdownKeyboardNavigation.ts@@ -17,7 +17,8 @@ import { doNotTranslate } from '@ui/utilities/internal/doNotTranslate';const TYPEAHEAD_RESET_DELAY = 500;export const useDropdownKeyboardNavigation = () => {- const { type, isSubmenu, setOpen, closeTree } = useDropdownContext();+ const { type, isSubmenu, setOpen, closeTree, tabForwardOutOfTree } =+ useDropdownContext();const direction = useDirection();const [typeahead, setTypeahead] = useState({ text: '', timestamp: 0 });@@ -81,6 +82,15 @@ export const useDropdownKeyboardNavigation = () => {return;}+ if (type === 'menu' && event.key === 'Tab' && isSubmenu) {+ event.preventDefault();+ tabForwardOutOfTree({+ ownerDocument: content.ownerDocument,+ tabOutEvent: event.nativeEvent,+ });+ return;+ }+const search = getDropdownSearch(content);const isSearch = target === search;if (isEditable && !isSearch) {