Make the snippet preview modal content always scrollable #10832
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR can be summarized in the following changelog entry:
Relevant technical choices:
This PR restores the plugin modal scrolling when the viewport height is smaller than the modal height.
Previously, the modal used an inline style set via the component
style
prop:style={ { height: "initial", minHeight: "50px" } }
The modal content uses
overflow: auto
to make its content scrollable but the scrolling mechanism needs a computed height to work. It doesn't work withheight: initial
orheight: auto
so this inline style is not a viable option. The PR removes this inline style. Now the modal content is scrollable again. The downside is that on big screens the modal height won't be based on its content height any longer and it will be the default height of the Gutenberg component (70%). This should be improved upstream and there's already an issue for that. I've also explored a possible solution, will push a PR soon.Test instructions
This PR can be tested by following these steps:
iPhone 6/7/8
oriPhone 6/7/8 Plus
in landscape orientationAs said, on big screens the modal won't extend his height to the content height and will be limited to 70%, see in the screenshot below:
Fixes #10811
Fixes #10703