carbon-components-svelte icon indicating copy to clipboard operation
carbon-components-svelte copied to clipboard

Modal position inside UIShell with a Header

Open albertms10 opened this issue 3 years ago • 2 comments

Description

When opening a Modal in a UIShell with a Header, it is positioned as if no Header was present, only taking into account a max-height: 90% of its parent. Therefore, the Modal footer is cut when the screen is not tall enough.

Svelte screen capture desktop

Moreover, when opening it in a mobile device, it is far taller and the footer is never shown, as the body is not scrollable due to the bx--body--with-modal-open class.

Svelte screen capture mobile

Question

Should the Header component be hidden behind the modal, filling the whole viewport size? Or maybe just shrink the height of the modal and vertically centre it inside the Content component?

albertms10 avatar Oct 07 '20 14:10 albertms10

This is probably a design decision by Carbon. https://github.com/carbon-design-system/carbon/issues

metonym avatar Oct 07 '20 16:10 metonym

Aside from being a design decision by Carbon, a possible workaround like this one could fix the issue, leading to a properly centred Modal window:

/* for explanatory purposes */
:root {
  --header-height: 3rem;
}

.bx--modal-container {
  position: relative;
  bottom: calc(var(--header-height) / 2);
  height: calc(90% - var(--header-height));
}

albertms10 avatar Oct 12 '20 14:10 albertms10