Skip to content

Inputs: Fixed margins on each variant and margin sizes#9517

Merged
henon merged 7 commits intoMudBlazor:devfrom
ralvarezing:fix/label-top-margin-not-enough
Aug 3, 2024
Merged

Inputs: Fixed margins on each variant and margin sizes#9517
henon merged 7 commits intoMudBlazor:devfrom
ralvarezing:fix/label-top-margin-not-enough

Conversation

@ralvarezing
Copy link
Member

@ralvarezing ralvarezing commented Jul 28, 2024

Description

Fix to the margin bug when using dense variant.
Margins are adjusted so when a label is set, this margin is enough to prevent other components to overlap the label.

Dense margins variant
image
image

None margins variant
image
image

Normal margins variant
image

fixes #9497

How Has This Been Tested?

  • Added a set of examples in the AllInputsTest page
  • Added switches to change Margin size and AlignItems value

Type of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation (fix or improvement to the website or code docs)

Checklist

  • The PR is submitted to the correct branch (dev).
  • My code follows the code style of this project.
  • I've added relevant tests.

@github-actions github-actions bot added the bug Unexpected behavior or functionality not working as intended label Jul 28, 2024
@ralvarezing ralvarezing changed the title Inputs: Fixed Inputs: Fixed margins on each variant and margin sizes Jul 28, 2024
@codecov
Copy link

codecov bot commented Jul 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.52%. Comparing base (28bc599) to head (7a616fe).
Report is 1103 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #9517      +/-   ##
==========================================
+ Coverage   89.82%   90.52%   +0.69%     
==========================================
  Files         412      407       -5     
  Lines       11878    12729     +851     
  Branches     2364     2466     +102     
==========================================
+ Hits        10670    11523     +853     
+ Misses        681      643      -38     
- Partials      527      563      +36     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ralvarezing ralvarezing marked this pull request as ready for review July 28, 2024 05:02
Copy link
Member

@danielchalmers danielchalmers left a comment

Choose a reason for hiding this comment

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

LGTM just a concern about backwards compatibility

@ralvarezing
Copy link
Member Author

ralvarezing commented Jul 29, 2024

LGTM just a concern about backwards compatibility

Ready, just added a question about the mud-input-input-control

Copy link
Member

@danielchalmers danielchalmers left a comment

Choose a reason for hiding this comment

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

Awesome, thanks for being willing to keep iterating on this

@henon
Copy link
Contributor

henon commented Aug 3, 2024

Are we sure this will not be viewed as a layout-breaking change?

Edit: Yes, it fixes a regression reported via #9497, sorry didn't see it at first.

@haas-daniel
Copy link
Contributor

Hi, the changes in _inputcontrol.scss break our layout. Now there are margins to the left and right of MudTextInput. Was this intended?

Try here

@danielchalmers
Copy link
Member

Hi, the changes in _inputcontrol.scss break our layout. Now there are margins to the left and right of MudTextInput. Was this intended?

Try here

cc @ralvarezing

@ralvarezing
Copy link
Member Author

@haas-daniel Yes, the two Dense and Normal margin sizes do have some left and right margins which can be removed adding Class="mx-0".

As if this was intended, yes
But could be something to review if it's something that is not wanted or ends up being a problem more than useful.
Maybe @henon or @danielchalmers can give some insight about this?

@henon
Copy link
Contributor

henon commented Aug 9, 2024

this was intended, yes

@ralvarezing Please state your reasons for adding the margin, thanks. I suspect you had good ones.

@ralvarezing
Copy link
Member Author

ralvarezing commented Aug 11, 2024

this was intended, yes

@ralvarezing Please state your reasons for adding the margin, thanks. I suspect you had good ones.

In my case is just because the Margin parameter seems to be a little inconsistent only affecting the vertical margins and not the horizontal margins.

But this is probably something that is subjective so will be interesting to see different opinions.
Didn't think on bringing this discussion when I opened the PR 😔

@haas-daniel, what are your thoughts?

Edit: In both cases, like it it now or was before, if you want or don't want horizontal margins, will be required to add Class="mx-0" or Class="mx-X". Unless you're using MudGrid and Spacing

@haas-daniel
Copy link
Contributor

IMHO the left and right margins should not be changed because it breaks the layout. Otherwise, it should at least be documented. (The documentation for MudTextField says "With the Margin property you can reduce the text field height.")

I "fixed" it in our project by defining css classes that override those from MudBlazor:

mud-input-control {
  &.mud-input-control-margin-dense {
    margin: 4px 0;
  }

  &.mud-input-control-margin-normal {
    margin: 8px 0;
  }
}

@ralvarezing
Copy link
Member Author

ralvarezing commented Aug 18, 2024

IMHO the left and right margins should not be changed because it breaks the layout. Otherwise, it should at least be documented. (The documentation for MudTextField says "With the Margin property you can reduce the text field height.")

I "fixed" it in our project by defining css classes that override those from MudBlazor:

mud-input-control {
  &.mud-input-control-margin-dense {
    margin: 4px 0;
  }

  &.mud-input-control-margin-normal {
    margin: 8px 0;
  }
}

@haas-daniel that's a great point, and something I wasn't aware to be honest.
Of corse this could be reverted with a small PR, or fixed the documentation depending in what is preferred.

@henon
Copy link
Contributor

henon commented Aug 18, 2024

Of corse this could be reverted with a small PR, or fixed the documentation depending in what is preferred.

@danielchalmers What do you advise?

@danielchalmers
Copy link
Member

I would change it back to not affect left and right margins because it's expected behavior and this popular library does it like that as well

@ralvarezing
Copy link
Member Author

ralvarezing commented Aug 18, 2024

Great! there I opened a pr to revert those margins: #9652

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Unexpected behavior or functionality not working as intended regression Previously worked and now doesn't

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Attribute Margin.Dense in the fields with Variant.Outlined used inside the Dialogs, breaks the label display

4 participants