Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bugfix] Fix Container Height #7313

Merged
merged 4 commits into from
Dec 16, 2024
Merged

[Bugfix] Fix Container Height #7313

merged 4 commits into from
Dec 16, 2024

Conversation

samhinshaw
Copy link
Contributor

@samhinshaw samhinshaw commented Dec 14, 2024

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

  1. https://github.com/plotly/plotly.js/blob/f8c7b5db5a150722538d6fed06e04ee176d98336/src/plot_api/subroutines.js#L55-L58

  2. https://codepen.io/samhinshaw/pen/XJrNgNL

  3. https://codepen.io/samhinshaw/pen/mybOwWm

@archmoj archmoj self-assigned this Dec 14, 2024
@archmoj archmoj marked this pull request as ready for review December 16, 2024 16:13
@archmoj
Copy link
Contributor

archmoj commented Dec 16, 2024

@samhinshaw Thanks very much for the PR. The v2.35.3 is released on Friday.
IMHO we should also include this patch on the next v3 pre-release ASAP.
@gvwilson please advise.

@archmoj archmoj merged commit 015ff80 into master Dec 16, 2024
1 check passed
@archmoj archmoj deleted the bugfix/set-container-height branch December 16, 2024 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WegGL Plots Fail to Render in Certain Circumstances Virtual WebGL Workaround Fails On 3d Plots
2 participants