mantinedev / mantine

A fully featured React components library
https://mantine.dev
MIT License
26.48k stars 1.88k forks source link

Position of popovers contained within button group can break when clicking inside popover. #6992

Open linuspahl opened 2 hours ago

linuspahl commented 2 hours ago

Dependencies check up

What version of @mantine/* packages do you have in package.json?

7.13.3

What package has an issue?

@mantine/core

What framework do you use?

create-react-app (CRA)

In which browsers you can reproduce the issue?

All

Describe the bug

In my case I have a simple Button.Group, which contains a Menu. The menu dropdown is not rendered within a portal (withinPortal={false}).

image

When I click on the menu dropdown instead of a menu item, the position of the dropdown changes. The same problem exists for other popovers like the Popover component.

position_problem

The reason seems to be that the button group has the following styling, which effects all focused child elements:

.m_80d6d844 :where(*):focus {
    position: relative;
    z-index: 1;
}

This overrides the position: absolute; of the popover.

If possible, include a link to a codesandbox with a minimal reproduction

https://codesandbox.io/p/sandbox/mantine-react-template-forked-24mzvw?file=%2Fsrc%2FApp.tsx%3A25%2C1

Possible fix

No response

Self-service

linuspahl commented 1 hour ago

A fix could be to define a more specific CSS selector, but I am not sure how the ideal selector should look like.

vishal590 commented 49 minutes ago

I cam silver this issue. Can someone assign me?