carbon icon indicating copy to clipboard operation
carbon copied to clipboard

Modal overflow

Open gyopak opened this issue 4 years ago • 7 comments

Modal overflow

Seems that Modal component has an overflow which trims overflowing components inside (eg. dropdown, tooltip)

What package(s) are you using?

  • [X] carbon-components
  • [X] carbon-components-react

Steps to reproduce the issue

  1. Create a modal
  2. Place an overflowing component (eg. dropdown) inside

CodeSandbox example

Additional information

opened (trimmed) dropbox inside the modal: Screenshot 2020-06-16 at 10 24 17

expected result: Screenshot 2020-06-16 at 10 25 01

gyopak avatar Jun 16 '20 08:06 gyopak

I have similar issue, may I know the schedule of this fix?

yrue avatar Aug 25 '20 04:08 yrue

@yrue in the meantime you can manually overwrite these overflows. Check #6289 or #6290

gyopak avatar Aug 25 '20 07:08 gyopak

Thanks @gyopak , but the fixes not work on my case. I changed the overflow: visible to bx--modal-container and overflow-y: visible to bx--modal-content but still not work as below image

Would it possible to add a props like menuPortalTarget of react-select (ref)to attach the menu to specific element?

yrue avatar Aug 26 '20 05:08 yrue

Hi @gyopak, I'm working on IBM Watson Knowledge Catalog and we are facing the same issue of dropdowns are truncated by the modal. The solution you provide (https://github.com/carbon-design-system/carbon/issues/6288#issuecomment-679847181) is working for small modals, where the actual content is not bigger than the modal. This is not always the case (on small screens or huge modals) as you can see in this example (I used your PRs and just duplicated the paragraphs): image Here is the modal working for small content: image

A smart workaround our DEV team did is adding a margin-bottom to the modal content to show 3 dropdown entries. image

A solution to this would be, as @yrue already addressed, is to provide a property on dropdowns/overflow menu to attach the menu list to a different element (outside modal content) so it can't be truncated by the modal. I know this can be an accessibility issue, but this can be solved by keeping the normal menu and just disable/hide it. I used this solution a lot within the primeNg framework - they provide a property called "appendTo" - maybe you can get some inspiration from their solution.

ConradSchmidt avatar Sep 18 '20 11:09 ConradSchmidt

I'm having the exact same issue with Dropdowns, but with ComposedModal.

Here's a repro of the problem: https://codesandbox.io/s/carbon-modal-dropdown-bug-ctbgc

See gif below:

Dropdown in Modal

Yohanna avatar Nov 26 '20 20:11 Yohanna

@kevinsperrine when it will be fixed?

mateBe95 avatar Dec 06 '21 09:12 mateBe95

@mateBe95 I'm not on the Carbon team, so I don't know. There are numerous outstanding issues related to this, but no prognosis or timeline yet. See:

https://github.com/carbon-design-system/carbon/issues/7565#issuecomment-786921600

kevinsperrine avatar Dec 06 '21 13:12 kevinsperrine

I have a workaround that i use for the ComposedModal react component.

I basically have a classname (overflowVisible) that I enable when my modal has a dropdown or something the needs to overflow. I then apply the following styles:

.Modal.overflowVisible {
    overflow-y: auto;

    .cds--modal-container,
    .cds--modal-content {
      overflow: visible;
    }

    .cds--modal-container {
      max-height: max-content;
      height: max-content;
      margin: auto;
    }
  }

Beware that this workaround will make prevent scrolling inside the modal content. If the modal height is too big, the outer shell of the modal will become scrollable.

OmranAbazid avatar Jun 07 '23 15:06 OmranAbazid

@OmranAbazid thanks for the workaround; too bad that this bug has been here since 2020.

marcellobarile avatar Sep 06 '23 08:09 marcellobarile

Hey just wanted to mention this is part of a systemic issue with popovers and floating elements that we hope to fully address with https://github.com/carbon-design-system/carbon/issues/14139. I know it doesn't fix the issue for you now, but we hope to have a solid solution for this soon. Thanks for your patience and +1 for that workaround!

tay1orjones avatar Sep 06 '23 16:09 tay1orjones