Skip to content

fix(grid): make --grid-maxWidth a true maximum instead of a fixed width - #5157

Open
fbasmaison-lucca wants to merge 2 commits into
masterfrom
fix/grid-max-width-as-true-max
Open

fix(grid): make --grid-maxWidth a true maximum instead of a fixed width#5157
fbasmaison-lucca wants to merge 2 commits into
masterfrom
fix/grid-max-width-as-true-max

Conversation

@fbasmaison-lucca

@fbasmaison-lucca fbasmaison-lucca commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Description

  • Grid: --grid-maxWidth now acts as a true maximum, not a fixed width.
  • Form grids keep an auto inline-size.
  • They no longer occupy 50rem when their content is narrower.

Note for reviewers

  • A few occurrences of --grid-max-width found outside LF.
  • #3154 reverted this same approach.
    • It broke horizontal fieldsets in their flex-based layout at the time.
  • The fieldset now uses a CSS grid layout (grid-template-columns: 1fr auto).
    • A child grid stretches to fill its cell.
    • The old breakage should no longer apply.

Context

  • mod-form sets --grid-maxWidth: var(--components-form-maxWidth, 50rem).
  • The grid consumed it through inline-size.
    • max-inline-size: 100% clamped it.
    • Result: a form grid always occupied 50rem, even with narrower content.
  • The default --grid-maxWidth: none is invalid for inline-size.
    • It resolved to auto only through IACVT.
    • It silently overrode any other inline-size declaration in the cascade.
  • Downstream symptom example: spurious horizontal scrollbar in a dialog.
    • The form grid forced its fieldset wider than the dialog content.
    • Sidenote: screenshots below come from LuccaSA/Cleemy.Front#905.
    • That PR works around the issue on the product side with pr-u-minInlineSize0.

Before:

Card order dialog with spurious horizontal scrollbar

After:

Card order dialog without horizontal scrollbar

Solution

  • Apply the variable through max-inline-size instead of inline-size.
    • This matches the original intent (commented-out line).
  • Remove the max-inline-size: 100% clamp.
    • Nothing can force an overflow without a fixed inline-size.
  • The default none is a valid value for max-inline-size.
    • No more reliance on IACVT.
  • Align the grid with the form component.
    • The form already uses max-inline-size: var(--components-form-maxWidth).

Fixes #5188


- Apply the maxWidth custom property through max-inline-size rather than inline-size.
- Keep an auto inline-size on mod-form grids: they no longer occupy 50rem when their content is narrower.
- Remove the max-inline-size: 100% clamp, unnecessary once no fixed inline-size can overflow.

Co-Authored-By: Claude <noreply@anthropic.com>
@fbasmaison-lucca fbasmaison-lucca added the 🤖 Produced by AI Some code was produced by AI. (Autocompleted code doesn't require to be labeled) label Jul 17, 2026
@github-actions

Copy link
Copy Markdown

🚀 Storybook preview deployed: https://pub-dc6d99acd6874e2aaff6219dd8a13ae2.r2.dev/PR-5157/index.html

@fbasmaison-lucca
fbasmaison-lucca marked this pull request as ready for review July 17, 2026 15:09
@fbasmaison-lucca
fbasmaison-lucca requested a review from a team as a code owner July 17, 2026 15:09
Copilot AI review requested due to automatic review settings July 17, 2026 15:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Updates grid sizing so --grid-maxWidth acts as a maximum and avoids forcing form grids beyond their container.

Changes:

  • Applies --grid-maxWidth through max-inline-size.
  • Removes the fixed inline size and redundant 100% clamp.

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

@shajz

shajz commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

@fbasmaison-lucca
Not a reviewer anymore but I notice this PR fixes my issue #5188 (inline-size: none invalid, resolved as auto by IACVT).

Might you add a tiny Fixes #5188 in the description please ? 😊

@vvalentin-lucca

Copy link
Copy Markdown
Contributor

This breaks the horizontal layout of the fieldset component.

Before:

Capture d’écran 2026-08-17 à 12 02 56

After:

Capture d’écran 2026-08-17 à 12 03 21

@jeremie-lucca jeremie-lucca modified the milestones: 22.0.1, 22.0.2 Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

📖 Documentation changes Requires a Prisme update 🤖 Produced by AI Some code was produced by AI. (Autocompleted code doesn't require to be labeled)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Grid] mode="form" inside a .form collapses — inline-size resolves to the invalid none

5 participants