[Textfield] Border lines of Textfield cross over the text label shrinked by MuiInputLabel

Open
#26,607 9 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Domain
design, frontend

Research direction

Start by running the linked CodeSandbox reproduction with the theme-level MuiInputLabel shrink setting and compare it with the per-TextField InputLabelProps case. Trace the TextField and MuiInputLabel entry points to identify the differing behavior. Done means the outlined border no longer crosses a label that is shrunk through the theme, with the existing per-component case still working.

Written by the indexing model from the issue text.

Description

scope: text field type: bug
  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

Borders of Textfield component cross over the shrinked text label.
image

Expected Behavior 🤔

Border lines overlapping with the shrinked text label are hidden.
image

Steps to Reproduce 🕹

https://codesandbox.io/s/elegant-leakey-zsflw?file=/src/App.tsx

source code
import {
  createTheme,
  Stack,
  TextField,
  ThemeProvider
} from "@material-ui/core";
import React from "react";

const theme = createTheme({
  components: {
    MuiInputLabel: {
      defaultProps: { shrink: true }
    }
  }
});

function App() {
  return (
    <ThemeProvider theme={theme}>
      <Stack sx={{ m: 5 }} spacing={2}>
        {/*NG*/}
        <TextField label="Abcdefghi" />
        {/*OK*/}
        <TextField label="Abcdefghi" InputLabelProps={{ shrink: true }} />
      </Stack>
    </ThemeProvider>
  );
}

export default App;

Steps:

  1. shrink: true is specified in theme.
  2. InputLabelProps = {{shrink: true}} is not specified in TextField.

Context 🔦

Your Environment 🌎

`npx @material-ui/envinfo`
my browser: Google Chrome 90.0.4430.212(Official Build)(x86_64)
my pc: macOS Big Sur ver 11.2.2

npx @material-ui/envinfo

  System:
    OS: Linux 5.4 Debian GNU/Linux 10 (buster) 10 (buster)
  Binaries:
    Node: 14.17.0 - /usr/local/bin/node
    Yarn: 1.22.5 - /usr/local/bin/yarn
    npm: 6.14.13 - /usr/local/bin/npm
  Browsers:
    Chrome: Not Found
    Firefox: Not Found
  npmPackages:
    @emotion/react: ^11.4.0 => 11.4.0 
    @emotion/styled: ^11.3.0 => 11.3.0 
    @material-ui/core: ^5.0.0-alpha.35 => 5.0.0-alpha.35 
    @material-ui/icons: ^5.0.0-alpha.35 => 5.0.0-alpha.35 
    @material-ui/private-theming:  5.0.0-alpha.35 
    @material-ui/styled-engine:  5.0.0-alpha.34 
    @material-ui/system:  5.0.0-alpha.35 
    @material-ui/types:  6.0.1 
    @material-ui/unstyled:  5.0.0-alpha.35 
    @material-ui/utils:  5.0.0-alpha.35 
    @types/react: ^17.0.8 => 17.0.9 
    react: ^17.0.2 => 17.0.2 
    react-dom: ^17.0.2 => 17.0.2 
    typescript: ^4.1.2 => 4.3.2 
Dominant language
JavaScript
Stars
99.1k
Forks
32.5k
Avg merge
2d 17h
Merged PRs (30d)
106

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from mui/material-ui

All issues in mui/material-ui

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.