Skip to content

fix: let charts in auto-height containers grow back after shrinking (… - #12300

Open
gbosetti wants to merge 1 commit into
chartjs:masterfrom
gbosetti:fix/12251-auto-height-container-growth
Open

fix: let charts in auto-height containers grow back after shrinking (…#12300
gbosetti wants to merge 1 commit into
chartjs:masterfrom
gbosetti:fix/12251-auto-height-container-growth

Conversation

@gbosetti

Copy link
Copy Markdown

Fix attempt for #12251

Before / bug After / fix
bug.mov
fix.1.mov
The chart was sizing itself against its container's height. With no fixed height, the container is just as tall as the chart, so the chart kept comparing against its own previous size: shrinks went through, growth never did. It now ignores the container's height when that height is only the chart's own, so it follows the container both ways.

Videos recorded on the docs animations page (the "Looping tension" example), served from a local build.

Notes

  • This is not just about zoom. It happens at devicePixelRatio 1 too — zoom just makes people resize more, so they notice it.
  • The clamp comes from fix: respect aspect ratio with container height #10646, which is right for containers with a fixed height. Those keep working the same way.

Tests

test/specs/issue.12251.tests.js — 5 specs: grow and shrink at DPR 1 and 1.35, repeated identical resizes, a looping animation, and a shrink-then-grow drag. They fail on master and pass with this change. The existing helpers.dom, platform.dom and core.controller suites (including the #10646 / #10693 fixed-height cases) still pass, in Chrome and Firefox.

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.

1 participant