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

NotchedOutline label may generate a large hidden box that generates overflow. #22301

Closed
ThomasKleffel opened this issue Aug 21, 2020 · 6 comments
Labels
bug 🐛 Something doesn't work component: text field This is the name of the generic UI component, not the React module! external dependency Blocked by external dependency, we can’t do anything about it

Comments

@ThomasKleffel
Copy link

ThomasKleffel commented Aug 21, 2020

If the label of a NotchedOutline is not currently notched, the maxWidth of the legend is set to 0.01 - this means that the text in the that's inside might be wrapped if it's longer ("Label Template (for preview)" in my case) and generate a block that is higher than the NotchedOutline itself. The is hidden, so that's not noticeable, but it will generate overflow that might cause a container to scroll.

I have fixed this for me by adding "white-space: nowrap" to the CSS properties of the inside the legendLabelled class.

Edit: Minimal example: https://codesandbox.io/s/elated-gauss-pxwn8

Capture d’écran 2020-08-23 à 15 06 04

@oliviertassinari oliviertassinari added the status: waiting for author Issue with insufficient information label Aug 21, 2020
@oliviertassinari
Copy link
Member

Please provide a minimal reproduction test case. This would help a lot 👷 .
A live example would be perfect. This codesandbox.io template may be a good starting point. Thank you!

@oliviertassinari oliviertassinari added duplicate This issue or pull request already exists and removed status: waiting for author Issue with insufficient information labels Aug 22, 2020
@oliviertassinari
Copy link
Member

Duplicate of #12255

@oliviertassinari oliviertassinari marked this as a duplicate of #12255 Aug 22, 2020
@ThomasKleffel
Copy link
Author

What I am proposing to fix is not really a duplicate of #12255. There the problem is that labels that are too long for one line are not properly positioned.

The issue I have is that even a short label (like "A B C D") generates a invisible overflowing box.

@oliviertassinari
Copy link
Member

@ThomasKleffel How do you reproduce the issue? What browser are you using? Do you have screenshots?

@ThomasKleffel
Copy link
Author

I am seeing the problem with Firefox 79.0 - I just checked with Chrome and Edge and there the problem is not visible.

The following screenshot shows how my minimal example looks for me in Firefox 79.0. The scrollbar should not be there.
OutlinedInput1

In the following picture I have patched the DOM to remove the "visibility: hidden" property of the span in the label to illustrate why the span's box is so high:
OutlinedInput-Firefox

In Chrome (next picture) the span's box is also higher than the DialogContent - however for some reason there is no scrollbar:
OutlinedInput-Chrome

@oliviertassinari oliviertassinari added bug 🐛 Something doesn't work component: text field This is the name of the generic UI component, not the React module! external dependency Blocked by external dependency, we can’t do anything about it and removed duplicate This issue or pull request already exists labels Aug 23, 2020
@oliviertassinari
Copy link
Member

oliviertassinari commented Aug 23, 2020

We had handled this issue in #20067, however, Firefox doesn't work with overflow hidden on a fieldset. I think that the simplest will be to report Firefox the issue and wait for a fix. The usage of white-space: nowrap leads to other layout issues. Moving overflow hidden to the legend leads to an issue with Safari and iOS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: text field This is the name of the generic UI component, not the React module! external dependency Blocked by external dependency, we can’t do anything about it
Projects
None yet
Development

No branches or pull requests

2 participants