Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FluentGrid becomes wider when Spacing increases #1588

Closed
sschutten opened this issue Feb 27, 2024 · 0 comments · Fixed by #1646
Closed

FluentGrid becomes wider when Spacing increases #1588

sschutten opened this issue Feb 27, 2024 · 0 comments · Fixed by #1646
Assignees
Labels
Milestone

Comments

@sschutten
Copy link
Contributor

🐛 Bug Report

The FluentGrid becomes wider the more the value for Spacing increases. I would assume it would remain the same width, only to increase the padding inside.

💻 Repro or Code Sample

The following razor shows 4 different grids with Spacing ranging from 1, 2, 3 and 10.

<div style="width: 500px; margin-left: auto; margin-right: auto; background-color: var(--neutral-layer-2)">
    <br />
    <FluentGrid Spacing="1" Justify="@JustifyContent.FlexStart" Style="background-color: var(--neutral-layer-4);">
        <FluentGridItem xs="12">
            <div class="card">
                Spacing=1
            </div>
        </FluentGridItem>
    </FluentGrid>
    <br />
    <FluentGrid Spacing="2" Justify="@JustifyContent.FlexStart" Style="background-color: var(--neutral-layer-4);">
        <FluentGridItem xs="12">
            <div class="card">
                Spacing=2
            </div>
        </FluentGridItem>
    </FluentGrid>
    <br />
    <br />
    <FluentGrid Spacing="3" Justify="@JustifyContent.FlexStart" Style="background-color: var(--neutral-layer-4);">
        <FluentGridItem xs="12">
            <div class="card">
                Spacing=3
            </div>
        </FluentGridItem>
    </FluentGrid>
    <br />
    <br/>
    <br />
    <FluentGrid Spacing="10" Justify="@JustifyContent.FlexStart" Style="background-color: var(--neutral-layer-4);">
        <FluentGridItem xs="12">
            <div class="card">
                Spacing=10
            </div>
        </FluentGridItem>
    </FluentGrid>

</div>

🤔 Expected Behavior

Each grid would be even wide.

😯 Current Behavior

The grid with the larger Spacing value is wider than the others, as shown in the screenshot below:

image

💁 Possible Solution

I think the approach for calculating the width and margin for the grid is off. According to the css, the width is increased with 8px per Spacing. The margin left and right increases each with 4px. Perhaps it's done with an very good reason, but I don't understand why.

🔦 Context

I'm trying to embed a FluentGrid inside a panel. Doing so causes a horizontal scrollbar to appear, because the child content is too wide due to the Spacing issue.

🌍 Your Environment

  • OS & Device: Windows 11 on PC
  • Browser Microsoft Edge
  • .NET and Fluent UI Blazor library version: 8.0.2 and 4.4.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants