[Bugfix] Fix Container Height #7313
Merged
+34
−1
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.
Resolves #7298
Resolves #7312
Summary of Changes
The plot container should always take the full with the height of its parent (the graph div). This ensures that for responsive plots without a height or width set, the paper div will take up the full height & width of the graph div. For responsive plots without a height or width set, if the plot container's height is left to 'auto', its height will be dictated by its childrens' height (plus its padding and border).
The plot container's only child is the paper div. In this scenario, the paper div's height will be set to 100%,1 which will be 100% of the plot container's auto height. That is meaninglesss, so the browser will use the paper div's children to set the height of the plot container instead.2 However, the paper div's children do not have any height, because they are all positioned absolutely, and therefore take up no space.3
Additional Information
Backport PR to Plotly v2: #7314
Footnotes
https://github.com/plotly/plotly.js/blob/f8c7b5db5a150722538d6fed06e04ee176d98336/src/plot_api/subroutines.js#L55-L58 ↩
https://codepen.io/samhinshaw/pen/XJrNgNL ↩
https://codepen.io/samhinshaw/pen/mybOwWm ↩