-
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
Dropdown menus should overlay scrollable areas #7565
Comments
@emyarod @ConradSchmidt I don't see how this could be considered an enhancement and not a defect. This issue also impacts Cognos Analytics (CA). Please reconsider it as a bug. |
This is a defect that impacts all of CPD. Some devs have been able to add margin/padding to the table or modal to somehow alleviate the problem, but it deviates from the design and should obviously be addressed at the component level instead. |
@PaulJThompson @Andrea-gm for context as to the label, most likely this is flagged as an enhancement as it would be a nontrivial change to the component itself and would need coordination with parent components in order to be accessible. Currently, the menu renders in-context in the current DOM tree which is what causes the layout shift to happen the way that it does. In order to break out / overlay the container, it would need to be rendered in portal / outside of the existing DOM tree. Unfortunately, this creates accessibility implications with respect to the menu. Since the menu no longer resides in DOM order, when the user interacts with it using a virtual cursor they can become lost on the page. It also can be problematic with dialog patterns as focus is supposed to remain trapped inside of the dialog. Here's a quick example using Airtable that demonstrates this behavior: Screen.Recording.2021-02-26.at.15.59.57.movIn this demo, I use VoiceOver's virtual cursor to move to the end of the menu, then back to the beginning. When traversing before the menu you see that it has lost the position on the page. Similarly, when going to the end of the group and going up a level it will go to the webpage root. This makes it difficult to "get back" to where a user was in the dialog. IBMa has provided some recommendations in this space over on Slack that we can investigate adding. I would assume this work would require:
Another path that we can go down is to see if we can figure out what direction the menu should open, or provide an option for developers to specify that direction, as an alternative scheme here if that's helpful 👍 I hope this is helpful with articulating where the component is right now, what challenges we may have, and what solutions we can consider moving forward. I'd be happy to sync up with any teams looking for this kind of functionality to figure out next steps, just let me know! |
@joshblack as a good starting point, https://carbondesignsystem.com/components/overflow-menu happens to be found in the same tables where inline dropdown is found but handles boundary cases in a better way. It can be mirror-flipped and also tends to avoid being clipped by the nearest parent. Any chance overflow menu already has some of the remedies needed here? |
@dglozic oh definitely, great example. Another similar option available now for teams running into this could be to use the In terms of auto-detection like in OverflowMenu, it's definitely something that we would like to add in since the check doesn't seem too bad and positioning isn't too hard if the item is placed in-context 👍 |
Right, I have not seen as many people complaining about OverflowMenu, which means that in practical use they tend to handle the floating panel with items in a decent way. I am mentioning it because it is an existing Carbon component so copying over its logic may be easier than devising something entirely new for dropdown menus. |
I remember having this issue some time ago (not using carbon at the time). This library was useful tether |
Going to close this since it seems we found a few reasonable ways to address this - |
@tay1orjones I don't see how we found reasonable ways to address this. For example, |
I believe tether binds components (in this case a popup menu) placed in the |
As @joshblack mentioned, attaching the dropdown to As I wrote in #9732, the way to have your cake and eat it too is to stop setting In the example linked above:
|
Reopening based on the previous #7565 (comment) above that there are some options that can be looked into. I think this can also apply to areas with That said, this thread contains quite a few other options to pursue if you're running into this problem. |
To be clear, attaching to |
One additional workaround for this is to use |
Summary
If a dropdown is used within a scrollable area they will be cut off by the surrounding container. This leads to broken layouts or even actions impossible to access.
Example (dropdown hidden by scrollable area and actions can't be accessed):
Try it here (IBM internal)
Currently only the DatePicker supports an
appendTo
option, which would solve this issue.This issue can't be resolved from the
outside
(css, add-ons, js, ...) - only the Carbon components itself can fix this issue, that is why it is so hard to deal with.Justification
This issue occurs in several products:
Desired UX and success metrics
The dropdown should overlay the scrollable container.
"Must have" functionality
The dropdown should overlay the scrollable container (see above).
Specific timeline issues / requests
As soon as possible, because there features which should be shipped by begin of February. Currently the design is asked to design around this issue, which shouldn't be the case.
NB: The Carbon team will try to work with your timeline, but it's not
guaranteed. The earlier you make a request in advance of a desired delivery
date, the better!
Available extra resources
What resources do you have to assist this effort?
Modal with dropdown issue(IBM internal)
Dialog appendTo plugin
Existing issue
Carbon is a collaborative system. We encourage teams to build components and
submit them for integration as either add-ons or core components.
The text was updated successfully, but these errors were encountered: