react icon indicating copy to clipboard operation
react copied to clipboard

[Bug] `ActionMenu` still scrolls if in `sticky` container

Open dipree opened this issue 1 year ago • 4 comments

Description

ActionMenu always has position: absolute. When in a container that is sticky it will consequently not stick with the container but with the absolute position. So, when scrolling it goes weeee 🚀

Showing the table of content of a readme in GitHub using an action menu, which is in a sticky container

Steps to reproduce

Put ActionMenu in a sticky container and scroll. For example, the table of content for the README in our repo https://github.com/github/primer, trigger the ActionMenu, than scroll.

Version

36.27.0

Browser

No response

dipree avatar Jul 26 '24 14:07 dipree

Can confirm, when scrolling it goes weeee 🚀 (😂)

@dipree we were taking a look at this during our maintainer sync and wanted to check-in to understand where this issue came from (did you happen to see this yourself or was it user reported?)

We're trying to see where this fits among our issues in terms of priority 👀

joshblack avatar Jul 29 '24 21:07 joshblack

please assign to me

Akashgite1 avatar Aug 04 '24 07:08 Akashgite1

@dipree we were taking a look at this during our maintainer sync and wanted to check-in to understand where this issue came from (did you happen to see this yourself or was it user reported?)

It has been reported in the past for the mentioned README toc, but I'm not sure anymore where that was unfortunately. I was just recently reminded of this again when putting an ActionMenu in a sticky header.

dipree avatar Aug 05 '24 10:08 dipree

The behavior you're describing occurs because position: absolute positions the element relative to its nearest positioned ancestor. In a sticky container, if there's no such ancestor, the element will be positioned relative to the document, which can cause it to move unexpectedly when scrolling.

Akashgite1 avatar Aug 05 '24 16:08 Akashgite1

Hi! This issue has been marked as stale because it has been open with no activity for 180 days. You can comment on the issue or remove the stale label to keep it open. If you do nothing, this issue will be closed in 7 days.

github-actions[bot] avatar Feb 22 '25 21:02 github-actions[bot]