Skip to content

fix(categorical-bin): size circles to content box when a bin is expanded#718

Merged
buckhalt merged 5 commits intonextfrom
fix/categorical-bin-expanded-sizing
Apr 22, 2026
Merged

fix(categorical-bin): size circles to content box when a bin is expanded#718
buckhalt merged 5 commits intonextfrom
fix/categorical-bin-expanded-sizing

Conversation

@buckhalt
Copy link
Copy Markdown
Member

@buckhalt buckhalt commented Apr 20, 2026

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 useCircleLayout by subtracting padding from clientWidth/clientHeight so 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:
Screenshot 2026-04-20 at 2 18 43 PM

After subtracting padding from clientWidth/clientHeight (bins too small):
Screenshot 2026-04-20 at 2 18 56 PM

Final:
Screenshot 2026-04-21 at 9 15 12 AM

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

todo:

  • update snapshots

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
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 useCircleLayout to measure available width/height using clientWidth/clientHeight minus computed padding.
  • Reuse a single getComputedStyle call to derive both gap and padding values for sizing calculations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/interviewer/Interfaces/CategoricalBin/useCircleLayout.ts Outdated
@github-actions
Copy link
Copy Markdown

❌ E2E tests — failure

📊 View report

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown

❌ E2E tests — failure

📊 View report

@jthrilly
Copy link
Copy Markdown
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.

@github-actions
Copy link
Copy Markdown

❌ E2E tests — failure

📊 View report

@github-actions
Copy link
Copy Markdown

❌ E2E tests — failure

📊 View report

@github-actions
Copy link
Copy Markdown

❌ E2E tests — failure

📊 View report

@github-actions
Copy link
Copy Markdown

✅ E2E tests — success

📊 View report

@buckhalt buckhalt marked this pull request as ready for review April 22, 2026 19:52
@buckhalt buckhalt merged commit 3cf58fc into next Apr 22, 2026
13 of 14 checks passed
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.

3 participants