question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Gutter width is not factored in to the minSize, leading to overflow

See original GitHub issue

I have a 3 pane horizontal view configured this way:

sizes: [10, 15, 75],
minSize: [0, 0, 0],
gutterSize: 2

I’ve added a button that when clicked “collapses” the first pane via setSizes([0, 15, 85]). (I did this instead of collapse so that I could allocate space to the last pane and not the second pane)

The problem is, when the first panel is collapsed, the third panel will get pushed down under the first two. This is happening because the size of the panels is calculated in an uneven way as follows:

Pane 1: width: calc(10% - 1px) Pane 2: width: calc(15% - 2px) Pane 3: width: calc(75% - 1px)

The width of the first gutter is being split in half across the first and last panes, which works perfectly fine when all 3 panes are in view, but once the first pane gets collapsed (Which renders the width of pane 1 to calc(0% - 1px) that half of that gutter isn’t being subtracted from anywhere anymore which causes the series to add up to 1px more than 100%, and the third pane to get pushed down to a new line.

Looking over the API I see it’s possible to interact with how the elements are sized via elementStyle, though I’m not sure if there’s a supported way to interact with the sizing in a way that targets specific elements rather than the whole set (In my case the problem would be solved if pane 2 and 3 subtracted 2px each while the first subtracted none)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
nathancahillcommented, Oct 26, 2018

Definitely something to consider 👍

0reactions
Autre31415commented, Oct 26, 2018

Yeah changing up the math a bit handles the shrinking problem, but it is worth noting that since this update required a code change to account for with my silly edge case there could be other examples of getSizes usage across other apps in the wild that this could unintentionally effect as well. It might be worth considering to dynamically account for the gutter size by padding out the - #px side of the CSS calc instead (if possible), since the value that getSizes returns is only the bare percentage pre calc.

Thanks for looking into this issue so quickly by the way! 😁 I’m glad my silly edge cases provided you with useful test cases

Read more comments on GitHub >

github_iconTop Results From Across the Web

Gutter width is not factored in to the minSize, leading to overflow ...
This sounds like a bug with how the 0% size is calculated. It should factor in the width of the gutter. Excellent bug...
Read more >
CSS Grid gutter is causing columns to overflow, how do I force ...
Short answer. Bear in mind, that for any given grid, you should never have gaps that multiplied by the columns will have bigger...
Read more >
Box gutters and overflows - Building Connection
As an example for commercial or industrial installations, gutters to have a minimum size of not less than 300 mm wide and 75...
Read more >
CSS Flexible Box Layout Module Level 1 - W3C
This value sizes the item according to the width/height properties, but makes the flex item fully inflexible. This is similar to initial, except ......
Read more >
Grid Cheatsheet
The overflow property applies to grid containers. ... Note: The size of the grid is not purely the sum of the track sizes,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found