Skip to content

fix(sheet): preserve responsive breakpoints when Resizable()#4605

Merged
dcrjodle merged 1 commit into
developmentfrom
fix/sheet-resizable-responsive-width
Jun 17, 2026
Merged

fix(sheet): preserve responsive breakpoints when Resizable()#4605
dcrjodle merged 1 commit into
developmentfrom
fix/sheet-resizable-responsive-width

Conversation

@dcrjodle

@dcrjodle dcrjodle commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Why is the fix specific to the Sheet widget?

Responsive width resolution is centralized and works correctly for every widget: widgetRenderer.tsx resolves props.width to the active breakpoint before the widget renders. Sheet is the only widget that rewrites its own Width in C# inside an extension method (Resizable()), upstream of that resolver — so it's the only place a Responsive<Size> can be silently flattened before it ever reaches the frontend.

(The narrower limitation in the Responsive<T> .At/.And API that makes this easy to hit is tracked as a follow-up.)

Problem

Resizable sheets with a multi-breakpoint responsive width collapse to a single fixed width (~384px) and overflow on larger screens.

Resizable() injects the resize min/max by reading only Width?.Default:

var width = sheet.Width?.Default ?? Sheet.DefaultWidth;

A Responsive<Size> that sets only Mobile/Tablet/Desktop/Wide (with Default == null) resolves to Sheet.DefaultWidth (Size.Rem(24) ≈ 384px), re-wrapped as a flat, non-responsive width — discarding every breakpoint rule. (Resizable() rewrites the width because the resizable frontend reads its initial/min/max from the serialized "value,min,max" string.)

Fix

Apply the default min/max to every populated breakpoint (ApplyConstraints), preserving the responsive ramp. Keeps each breakpoint's explicit Min/Max when set, falls back to a single constrained default only when no breakpoint is set, and applies the same handling to the height axis for top/bottom sheets.

Tests

New SheetResizableTests (4 cases) — the first reproduces the failing ramp; all would fail under the old .Default-only behavior. Build clean, 47/47 Sheet+Responsive tests pass, dotnet format clean.

🤖 Generated with Claude Code

Sheet.Resizable() read only Width?.Default when injecting resize
min/max constraints, collapsing any multi-breakpoint Responsive<Size>
down to the fallback default width. A responsive width that sets only
Mobile/Tablet/Desktop/Wide (Default == null) therefore resolved to
Sheet.DefaultWidth (Rem 24 ≈ 384px) and was re-wrapped as a flat,
non-responsive width — pinning the sheet to ~384px and overflowing
content on larger screens.

Apply the min/max to every populated breakpoint via ApplyConstraints
so the per-breakpoint ramp survives. Falls back to a single constrained
default only when no breakpoint is set, and never overrides explicit
per-breakpoint min/max. Same handling for the height axis (top/bottom
sheets).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Comment thread src/Ivy/Widgets/Sheet.cs
{
height = height.Max(Size.Px(900));
}
var height = ApplyConstraints(sheet.Height, Sheet.DefaultHeight, Size.Px(100), Size.Px(900));

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

maybe this could and should have been hard-coded as a default value in the frontend (like some other default values in frontend for other widgets)

@rorychatt rorychatt left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Left minor feedback

-> I see that some other edge cases might brake, but time will tell.

The comment is about an already existing bad pattern, so IMO this is merge-able, but maybe we should fix/open issue about the default value coded in BE, not in FE

@dcrjodle dcrjodle merged commit 69eac48 into development Jun 17, 2026
12 of 14 checks passed
@artem-ivy-ai

Copy link
Copy Markdown
Collaborator

Staging removed

Staging environment has been deleted for this PR.

@rorychatt rorychatt deleted the fix/sheet-resizable-responsive-width branch June 25, 2026 06:10
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