MudBlazor / MudBlazor

Blazor Component Library based on Material design with an emphasis on ease of use. Mainly written in C# with Javascript kept to a bare minimum it empowers .NET developers to easily debug it if needed.
http://mudblazor.com
MIT License
7.8k stars 1.25k forks source link

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

Closed Hiden46 closed 1 month ago

Hiden46 commented 1 month ago

Things to check

Bug type

Component, Other

Component name

MudDialog

What happened?

Using the Margin.Dense and the Variant.Outline attribute for components breaks the label display when used in Dialogs

bug

Expected behavior

The label should always be visible

Reproduction link

https://try.mudblazor.com/snippet/mkwSOhcpSyarwnUU

Reproduction steps

  1. Use dialog
  2. Add a MudTextFieldinside <DialogContent>
  3. Use the attribute Margin="Margin.Dense" and Variant="Variant.Outlined"
  4. Start the project and focus on the component

Relevant log output

No response

Version (bug)

7.4.0

Version (working)

No response

What browsers are you seeing the problem on?

Chrome, Edge

On which operating systems are you experiencing the issue?

Windows

Pull Request

Code of Conduct

Hiden46 commented 1 month ago

I have currently fixed it by overriding the class in the css like this:

.mud-input-control.mud-input-control-margin-dense {
    margin-top: 6px;
}

The default value is margin-top: 3px;

danielchalmers commented 1 month ago

@ralvarezing , could this be related to #8540?

ralvarezing commented 1 month ago

I'll take a look and come back to you

ralvarezing commented 1 month ago

For what I could see, the cut is caused by #8540 partially. Yes, the label is higher than the margin it has defined on top, and the cut is finally caused by the DialogContent due to the overflow:auto.

It should be an easy fix adding the missing margin to the text field, and also the margin has to be added to the .mud-input-control, instead of the .mud-input div (Something I didn't saw at the moment).

image image

I'll be working on that and probablly open a PR late today

ralvarezing commented 1 month ago

For what I could see, the cut is caused by #8540 partially. Yes, the label is higher than the margin it has defined on top, and the cut is finally caused by the DialogContent due to the overflow:auto.

It should be an easy fix adding the missing margin to the text field, and also the margin has to be added to the .mud-input-control, instead of the .mud-input div (Something I didn't saw at the moment).

image image

I'll be working on that and probablly open a PR late today

Well, yesterday wasn't possible to open a PR, but look deeper into this issue and noted that #8540 was not the root of this.

A top margin is required to be added to the dense version (now it's at 3px) so the label fits in. A margin between 6px and 8px should do the trick (8 would be half the non dense version). Only this would solve this issue but will add a little margin to the top, even when no lavel is set, that #8540 was trying to avoid. The solution to this last bit is not quite direct, but if I can, today will do some testing if can be avoided.