diff --git a/src/mantine-core/src/Menu/Menu.story.tsx b/src/mantine-core/src/Menu/Menu.story.tsx index ce43670c956..366430da604 100644 --- a/src/mantine-core/src/Menu/Menu.story.tsx +++ b/src/mantine-core/src/Menu/Menu.story.tsx @@ -1,4 +1,4 @@ -import React, { useState, useEffect } from 'react'; +import React from 'react'; import { IconTable, IconSearch } from '@tabler/icons'; import { WithinOverlays } from '@mantine/storybook'; import { Menu } from './Menu'; @@ -87,42 +87,3 @@ export function MenuTargetWithTooltip() { ); } - -export function WithinStickyHeaderPortal() { - const [isSticky, setIsSticky] = useState(false); - - useEffect(() => { - const makeSticky = () => { - setIsSticky(window.scrollY > 0); - }; - - document.addEventListener('scroll', makeSticky); - - return () => { - document.removeEventListener('scroll', makeSticky); - }; - }); - - return ( -
-
-
Header
-
- - - - - - - Item 1 - Item 2 - - -
-
-
- ); -} diff --git a/src/mantine-core/src/Menu/MenuTarget/MenuTarget.tsx b/src/mantine-core/src/Menu/MenuTarget/MenuTarget.tsx index 4d3fc3d7e1b..ff86dba2613 100644 --- a/src/mantine-core/src/Menu/MenuTarget/MenuTarget.tsx +++ b/src/mantine-core/src/Menu/MenuTarget/MenuTarget.tsx @@ -1,4 +1,4 @@ -import React, { cloneElement, forwardRef, useEffect } from 'react'; +import React, { cloneElement, forwardRef } from 'react'; import { isElement, createEventHandler } from '@mantine/utils'; import { useMenuContext } from '../Menu.context'; import { Popover } from '../../Popover'; @@ -35,8 +35,6 @@ export const MenuTarget = forwardRef( () => ctx.trigger === 'hover' && ctx.closeDropdown() ); - useEffect(() => ctx.closeDropdown, [children]); - return ( {cloneElement(children, {