Material-ui: [TextField] Underline misalignment when Divider present

Created on 25 Apr 2020  路  10Comments  路  Source: mui-org/material-ui

  • [x] The issue is present in the latest release.
  • [x] I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 馃槸

It seems that when using <TextField select={true} /> and when there is a <Divider /> element somewhere in the tree above the underline is one pixel off
image

The same is happening to the Filled variant

Expected Behavior 馃

The elements should be colinear despite presence of Divider anywhere on the tree

Steps to Reproduce 馃暪

Edit still-microservice-dzqk4

Your Environment 馃寧

| Tech | Version |
| ----------- | ------- |
| Material-UI | v4.9.11 |
| React | v16.13.1 |
| Browser | Chrome 81.0.4044.122 |

bug 馃悰 Select TextField good first issue

Most helpful comment

@esseswann I have just tested it, it seems that we fixed the issue later on by forcing the height. I think that we can move forward.

All 10 comments

It looks alright in my env.

I just checked it on a Linux machine and it looks ok there. It seems to be present on Windows
This is latest Chrome 81.0.4044.122 in Incognito (no extensions) from current master on Win10
image

It is not present on Edge though
image

It seams a problem of height. If you try to change the zoom of the page you can see the error.
I think that something like this can solve

+++ b/packages/material-ui/src/TextField/TextField.js
@@ -20,6 +20,9 @@ const variantComponent = {
 export const styles = {
   /* Styles applied to the root element. */
   root: {},
+  fullHeight: {
+    height: "100%",
+  },
 };

 /**
@@ -149,6 +152,10 @@ const TextField = React.forwardRef(function TextField(props, ref) {
       inputProps={inputProps}
       {...InputMore}
       {...InputProps}
+       className={clsx(
+         classes.fullHeight,
+         InputProps?.className,
+       )}
     />
   );

@@ -179,6 +186,10 @@ const TextField = React.forwardRef(function TextField(props, ref) {
           value={value}
           input={InputElement}
           {...SelectProps}
+           className={clsx(
+             classes.fullHeight,
+             SelectProps?.className,
+           )}
         >
           {children}
         </Select>

@marcosvega91 Looking at the history, it seems that we can remove an older patch for #13302:

diff --git a/packages/material-ui/src/NativeSelect/NativeSelect.js b/packages/material-ui/src/NativeSelect/NativeSelect.js
index 00464905b..8d86decaf 100644
--- a/packages/material-ui/src/NativeSelect/NativeSelect.js
+++ b/packages/material-ui/src/NativeSelect/NativeSelect.js
@@ -58,7 +58,6 @@ export const styles = (theme) => ({
   },
   /* Styles applied to the select component `selectMenu` class. */
   selectMenu: {
-    height: 'auto', // Reset
     textOverflow: 'ellipsis',
     whiteSpace: 'nowrap',
     overflow: 'hidden',

Would that work?

@marcosvega91 I noticed that simple removal of height: auto helps, but git blame shows that that this is some kind of native-select fix for FF. I am not sure that it is still actual because removing it does not break anything

--- a/packages/material-ui/src/NativeSelect/NativeSelect.js
+++ b/packages/material-ui/src/NativeSelect/NativeSelect.js
@@ -58,7 @@ export const styles = (theme) => ({
   },
   /* Styles applied to the select component `selectMenu` class. */
   selectMenu: {
-    height: 'auto', // Reset
     textOverflow: 'ellipsis',
     whiteSpace: 'nowrap',
     overflow: 'hidden',

@esseswann I have just tested it, it seems that we fixed the issue later on by forcing the height. I think that we can move forward.

Seems to be working on the variant=filled aswell
image

@oliviertassinari So does anybody make a pull request? :)

does anybody make a pull request? :)

@esseswann Priority to the author of the issues ;)

preview2

I was checking it for NativeSelect and accidentally noticed that NativeSelect from current master no longer works, the dropdown is not opening onClick. It works on the website though. FF\Edge also seem to be broken
I did not apply any fixes, might be a separate issue

@esseswann Solved in #20777.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

TimoRuetten picture TimoRuetten  路  3Comments

revskill10 picture revskill10  路  3Comments

sys13 picture sys13  路  3Comments

reflog picture reflog  路  3Comments

rbozan picture rbozan  路  3Comments