📝 Originally published (in Japanese) at forge.workstyle.tech .
TL;DR A slide fitting check measured a box whose min-height kept it at the viewport height. The scrollHeight and clientHeight comparison then kept reporting that the content did not fit, even as its zoom changed. The search reached its lower bound of 0.3 on both mobile and desktop.
TL;DR
All slides shrank to 30% because the box used for the fit check had a min-height set to the viewport height. Measuring the box kept reporting that the content did not fit, even as the scale changed, so the binary search shrank it to the 0.3 lower bound. The fix was to temporarily set the content’s min-height to 0, measure its offsetHeight , and then restore the original value.
How I Built a System That Shrinks Only Slides That Overflow
I used CSS zoom to add a system that shrinks only content that overflows. It measures the height, then uses binary search—a method that narrows the search range by half each time—to find a scale that fits.…