Material-ui: [Autocomplete] Adding startAdornment results in extra top padding on IE11 only

Created on 13 Jan 2020  ยท  9Comments  ยท  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 ๐Ÿ˜ฏ

Using a startAdornment on AutoComplete's renderInput results in an extra top padding on IE11.

We've seen it with the outlined variant, but only when we set a placeholder.(i.e. works with label).

Manually setting the TextField's notched property to false appears to "fix" it.

Here's the issue in action (the table structure mimicks the components' placement on the screenshots):

Chrome Label Placeholder
Regular
Label + startAdornment Placeholder + startAdornment
IE11 Label Placeholder Padded
Label + startAdornment Placeholder + startAdornment

Inspecting the generated DOM element shows that the <fieldset> tag has a top: -5px property which, when cleared, fixes the issue:

Inspected

.PrivateNotchedOutline-root-85 {
  top: -5px;    <-----
  left: 0;
  right: 0;
  ...
}

Expected Behavior ๐Ÿค”

Should be identical to the other browsers (tested on 5 others, listed below)

Steps to Reproduce ๐Ÿ•น

The modified Material UI autocomplete demo above should show the issue, but unfortunately _codesandbox.io_ is currently broken on IE11 due to transpiling issues.

The gist of the demo is to create an AutoComplete with the placeholder and startAdornment params set on renderInput's TextField and visualize it on IE11:

renderInput={params => (
  <TextField
    {...params}
    placeholder="Placeholder text"
    variant="outlined"
    InputProps={{
      ...params.InputProps,
      startAdornment: <span>span</span>
    }}
    fullWidth
  />
)}

Context ๐Ÿ”ฆ

We're happy MaterialUI users with IE11 users ๐Ÿ˜„

Your Environment ๐ŸŒŽ

| Tech | Version |
| ----------- | ------- |
| @material-ui/core | 4.7.2 |
| @material-ui/lab | 4.0.0-alpha.38
| React | 16.12.0 |
| Browser | IE11 (โŒ ), Chrome 79 (โœ…) , Firefox 72(โœ…), Edge 18(โœ… , Edge 79(โœ… ), Safari 13 (โœ… )|

Thanks for this great project!

bug ๐Ÿ› Autocomplete good first issue

Most helpful comment

"Please mind the gap between the train and the station" ๐Ÿ™‰

All 9 comments

@aisamu Did you find a solution that we could consider deploying? What's so special about the autocomplete that breaks it?

I'm not sure.
Manually setting the TextField's notched property to false removes the extra padding from IE11, bringing it in line with the other browsers.
The reason I'm not confident to call that a fix is that the other browsers work without that flag set.

@aisamu We very likely have a solution in https://github.com/mui-org/material-ui/pull/17680#issuecomment-575398230. Could you confirm?

@oliviertassinari Yup, but I'm unsure how to test that locally.

yarn add https://github.com/eps1lon/material-ui.git#7d61d14hangs at "resolving packages..." , so I cloned the repo and added links for the relevant packages, per yarn's documentation

yarn add link:../material-ui/packages/material-ui
yarn add link:../material-ui/packages/material-ui-icons
yarn add link:../material-ui/packages/material-ui-lab

That apparently works, and package.json seems to be correctly populated:

    "@material-ui/core": "link:../material-ui/packages/material-ui",
    "@material-ui/icons": "link:../material-ui/packages/material-ui-icons",
    "@material-ui/lab": "link:../material-ui/packages/material-ui-lab",

Unfortunately, the build fails to resolve things properly, emitting errors like this:

looking for modules in /projects/my-project/node_modules
  using description file: /projects/my-project/package.json (relative path: ./node_modules)
    using description file: /projects/my-project/node_modules/@material-ui/core/package.json (relative path: ./Typography)
      no extension
        resolved symlink to /projects/material-ui/packages/material-ui/Typography
          using description file: /projects/material-ui/packages/material-ui/package.json (relative path: ./Typography)
            no extension
              /projects/material-ui/packages/material-ui/Typography doesn't exist
            .wasm
              /projects/material-ui/packages/material-ui/Typography.wasm doesn't exist
            .mjs
              /projects/material-ui/packages/material-ui/Typography.mjs doesn't exist
            .js
              /projects/material-ui/packages/material-ui/Typography.js doesn't exist
...

There is a Typography.js, but on /projects/material-ui/packages/material-ui/ src/Typography/ Typography.js"

I'm not sure if that's related to the way material-ui packages things separately on the mono-repo or if it's due to our own webpack setup.

Using fully resolved links on package.json yielded the same results
(as in "@material-ui/core": "link:/projects/material-ui/packages/material-ui")

@aisamu You could open your node_modules and apply the patch. I have never seen yarn link really work here.

@aisamu We very likely have a solution[...]. Could you confirm?

The height is now correct (IE11 now matches Chrome/FF/Safari), but it looks like there's a small visual regression when placeholders are used instead of labels (on all browsers), in the form of a discontinuity on the outline:

| Chrome | Screen Shot 2020-01-19 at 23 35 09 |
| ---- | -----|
| IE11 | Screen Shot 2020-01-19 at 23 35 29 |

Don't worry about the gap, it's another issue and being taken care of.

Don't worry about the gap

London Underground would like to have a word with you

it's another issue _and being taken care of._

Again, thanks!

"Please mind the gap between the train and the station" ๐Ÿ™‰

Was this page helpful?
0 / 5 - 0 ratings