Skip to content

Commit 68ea5bb

Browse files
committed
✨ fix(menu): remove submenu animation
- Introduced `data-submenu` attribute to the `ContextMenu.Positioner` and `DropdownMenuPositioner` components for improved submenu handling. - Updated styles in `sharedStyle.ts` to manage submenu animations effectively. This enhancement improves the functionality and styling of dropdown and context menus, ensuring better user experience with submenus. Signed-off-by: Innei <tukon479@gmail.com>
1 parent b7c32aa commit 68ea5bb

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

src/ContextMenu/renderItems.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ export const renderContextMenuItems = (
278278
<ContextMenu.Positioner
279279
alignOffset={-4}
280280
className={styles.positioner}
281+
data-submenu=""
281282
onContextMenu={preventDefaultAndStopPropagation}
282283
sideOffset={-1}
283284
>

src/DropdownMenu/renderItems.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ export const renderDropdownMenuItems = (
206206
})}
207207
</DropdownMenuSubmenuTrigger>
208208
<DropdownMenuPortal>
209-
<DropdownMenuPositioner alignOffset={-4} sideOffset={-1}>
209+
<DropdownMenuPositioner alignOffset={-4} data-submenu="" sideOffset={-1}>
210210
<DropdownMenuPopup>
211211
{submenu.children
212212
? renderDropdownMenuItems(submenu.children, nextKeyPath, { iconSpaceMode })

src/Menu/sharedStyle.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,11 @@ export const styles = createStaticStyles(({ css, cssVar }) => ({
170170
&[data-hover-trigger] {
171171
--lobe-dropdown-animation-duration: 140ms;
172172
}
173+
174+
&[data-submenu] {
175+
--lobe-dropdown-animation-duration: 0ms;
176+
--lobe-dropdown-animation-scale-y: 1;
177+
}
173178
`,
174179

175180
separator: css`

0 commit comments

Comments
 (0)