Modal with fixed footer (content height support) #8680
andkorsh
started this conversation in
Feature requests
Replies: 1 comment
-
|
upd: Using
Since I don't care if contentheight is on a DOM element or not, this workaround is acceptable for now. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
It seems there is currently (as of 8.3.13) no way to specify a modal content height. The Modal component props type does have
hproperty which seemingly does not have any effect. It could be beneficial to have the ability to specify the modal type mainly to have a fixed (always visible) footer.One way to achieve the fixed footer currently is to specify height and max-height on the body container:
The problem with this approach is that it is necessary to specify max-height - without it, the modal container will have the scroll on smaller screens which we're trying to avoid. Specifying max-height, however, is problematic. Using 'vh' units doesn't really work here. What max-height would need to be is
100vh - 2*offset - header height; and while it's possible to calculate the2*offset, the header height is unknown and variable.There is another way to make it work, which is near-perfect:
This approach gives exactly the desired behavior with minimal configuration. The only caveat is that the
hproperty is automatically passed down to the DOM (assigned tomantine-Modal-rootelement) where it doesn't really do anything at all - just a bit 'hacky'.I have also tried extending the props and use
contentHeightinstead ofh:But this gives a react warning
React does not recognize the contentHeight prop on a DOM elementtherefore I had abandoned this idea.Anyhow, in this feature request I'm suggesting adding
contentHeightproperty to Modal component which, if specified, would convert modal 'content' into a flexbox.If this request is approved, I can provide a pull request - please let me know if this is helpful. In the meantime, we can live with the 'hacky' h-prop approach.
thanks!
Beta Was this translation helpful? Give feedback.
All reactions