fix(categorical-bin): size circles to content box when a bin is expanded#718
Merged
fix(categorical-bin): size circles to content box when a bin is expanded#718
Conversation
when a bin expands, padding is added and the available space is reduced. we need to subtract padding so that the other circles resize for the new content area to prevent overflow
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes Categorical Bin circle sizing when a bin is expanded by ensuring the layout calculation uses the container’s content box (excluding the reserved padding for the expanded panel), preventing other bins from overflowing.
Changes:
- Update
useCircleLayoutto measure available width/height usingclientWidth/clientHeightminus computed padding. - Reuse a single
getComputedStylecall to derive bothgapand padding values for sizing calculations.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
❌ E2E tests — failure |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
❌ E2E tests — failure |
Member
|
I think we need to add some logic to this for high bin numbers so that the open panel takes up less space. The bins are far too small right now. |
|
❌ E2E tests — failure |
|
❌ E2E tests — failure |
|
❌ E2E tests — failure |
|
✅ E2E tests — success |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
When a Categorical Bin is expanded, other bins were sometimes overflowing the container. This was due to bins not resizing to fit the new content area after padding is added to reserve space for the expanded bin's panel.
Fix involves measuring the flex container's content box in
useCircleLayoutby subtracting padding fromclientWidth/clientHeightso that the remaining bins are sized for the space actually available to them.This made the closed bins sizes too small. Added logic to shrink the expanded panel as bin count grows.
Before:

After subtracting padding from

clientWidth/clientHeight(bins too small):Final:

Reproducible in the Categorical Bin storybook (Interview/Interfaces/CategoricalBin -> Default) with 10 bins using
categoryCountand clicking a bin to expand it.todo: