-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Overflow menu doesn't scroll with page #911
Comments
Can you create a codepen to show the issue you are having. I am unable to duplicate. Thanks! https://codepen.io/team/carbon/full/MOEwjp/ |
and probably similar issue: its a screen recording, you need to unzip and play. Github doesn't allow me to attach videos. |
You won;t be able to reproduce it if you just use stock sample. See my screen shot, I have cards, at least 4 cards, and make the screen just fit for 3 and try it. Please can you take a look of the video I attached above. |
Can you recreate the sample in something like codesandbox or codepen? I see the issue, but without actually being able to look at the code there is not much we can do to help |
Hi, it turns out something to do with overflow-y: auto settings on the div we have. So we have something like this
The result is, we create a sticky header and footer, so that only the div with overflow-y:auto is scrollable. The overflow menu is in that scrollable view. When we click the three dots, the menus (ul wiith li s) are created outside of that div, so i think that is the why the overflow menu doesn't scroll with the content of the div. So is there a way to let overflow menu to be placed inside the div, e.g. close to the element contains three dots so that it could stay with the 3 dots menu when scrolling? |
@travis1111 Currently not - We know there is a need for “custom floating menu target” mechanism, though, e.g. #910 - Will see if we can come up with something simple. |
Thanks @asudoh also did you see the video I pasted above? bug.mp4.zip, I think it is also related, the ul is placed outside of the scrollable area. Do you have a rough timeline for when this can be fixed? |
@travis1111 Not at this moment - Meanwhile, feel free to copy |
Oops I totally forgot that the floating menu code looks at an element with |
This change makes `<FloatingMenu>` support an element to put the menu into, which is, the ancestor of the trigger buttun with `data-floating-menu-container` attribute. This change also removes code for React15-, which we dropped the support from 9.x codebase. Refs carbon-design-system/carbon#910. Refs carbon-design-system/carbon#911.
This change makes `<FloatingMenu>` support an element to put the menu into, which is, the ancestor of the trigger button with `data-floating-menu-container` attribute. This change also removes code for React15-, which we dropped the support from 9.x codebase. Refs carbon-design-system/carbon#910. Refs carbon-design-system/carbon#911.
This change makes `<FloatingMenu>` support an element to put the menu into, which is, the ancestor of the trigger button with `data-floating-menu-container` attribute. This change also removes code for React15-, which we dropped the support from 9.x codebase. Refs carbon-design-system/carbon#910. Refs carbon-design-system/carbon#911.
Wrt the movie in the zip - It appears different from the issue with scrolling this PR is taking about. Feel free to open a separate issue if the problem still exists. Thanks! |
@asudoh thanks. how do I use this attribute? something like this? <div class="parent">
<div data-overflow-menu data-floating-menu-container=".parent" ..... |
@travis1111 You are right assuming the 1st |
hmm then it is not working... here is the demo code (I forked from your official codepen): |
Oops I had a oversight looking at your HTML - It should be: <div data-floating-menu-container>
<div data-overflow-menu ...>
...
</div>
</div> |
@asudoh Hi, i tried this
Still not working. here is an example: |
Floating menu uses |
thanks. but the y position is off... I added one more, you can see y position is doubled... |
There is an option in overflow menu for you, which is |
Thanks I have made this working https://codepen.io/anon/pen/QBgbVJ/ But I don't understand why I had to add a callback to adjust the position. Also do you mind check if the code I have on codepen makes sense? Also I used the same code (as above) in our project, the |
Hi @travis1111 good question - What floating menu, the underlining mechanism of overflow menu, does is getting the position of the trigger button relative to the top/left corner of the viewport via CSSOM API and setting the top/left position of the menu based on that. Though we know that this is not something that will work for every usage pattern of floating menu, we also know that an attempt to support every usage pattern is almost impossible and tend to cause bloated, error-prone code. From that reason, what we do is setting the position that works for the most common pattern and provide an API to adjust the menu position. BTW I see |
Thanks @asudoh Yes, the callback in codepen works, but it did not work in our project. Is there any settings to prevent it from calling? is the callback only available in latest version? |
@travis111 The most possible cause is the component was instantiated already before you tried to instatiate it with the option. Static |
Thanks but I have this code
and if I comment out |
Still don't know why... this is what shows in the debugger of my project: and step in: and this is what shows in codepen: When the _changeState.apply is called, the codepen source has the correct offset object which is a callback I defined, but in my project it is replaced by |
@travis1111 You may want to debug the Whether or not your |
@asudoh I changed the source code and ran it in the debugger, no existing components, as you can see from the debugger below. So what I do next? |
@travis1111 I see you are using “flip mode” of floating menu. My apologies not imagining you using that, but the option to use for flip mode is |
thanks change to |
Hi 👋 I recently got a document update, which you may want to refer to: https://github.com/IBM/carbon-components/tree/ad19b01/src/components/overflow-menu#example---changing-menu-position-by-8-pixels-vertically You can search for channels with Carbon names in our internal communication tool to reach out to us internally. |
Detailed description
I have a page has many cards, there is a overflow menu (three vertical dots) on each card. I can click on the menu (three dots) to bring the drop down menu. However if the page has scroll bar (too many cards to fit into one page), when I scroll down, the drop down menu stays where it was, it won't scroll with the card it attached too.
Overflow menu
Should scroll with the menu icon (three dots)
Chrome
Latest
Microclimate
Steps to reproduce the issue
see description;
Additional information
Add labels
Please choose the appropriate label(s) from our existing label list to ensure that your issue is properly categorized. This will help us to better understand and address your issue.
The text was updated successfully, but these errors were encountered: