From 3efe5a1b8308233bbc24d2828a79a94f8a3bae19 Mon Sep 17 00:00:00 2001 From: Olivier Tassinari Date: Sat, 31 Dec 2022 20:32:34 +0100 Subject: [PATCH] Revert "[TextField] Fix error focus style (#35167)" This reverts commit df49d6a93c8912fef18ffe06a03658263b245fb1. --- .../mui-material/src/FilledInput/FilledInput.js | 12 ++++-------- packages/mui-material/src/Input/Input.js | 14 +++++--------- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/packages/mui-material/src/FilledInput/FilledInput.js b/packages/mui-material/src/FilledInput/FilledInput.js index 99200acd1c8579..b75c193338722d 100644 --- a/packages/mui-material/src/FilledInput/FilledInput.js +++ b/packages/mui-material/src/FilledInput/FilledInput.js @@ -91,13 +91,9 @@ const FilledInputRoot = styled(InputBaseRoot, { // See https://github.com/mui/material-ui/issues/31766 transform: 'scaleX(1) translateX(0)', }, - [`&.${filledInputClasses.error}`]: { - '&:before, &:after': { - borderBottomColor: (theme.vars || theme).palette.error.main, - }, - '&:focus-within:after': { - transform: 'scaleX(1)', // error is always underlined in red - }, + [`&.${filledInputClasses.error}:after`]: { + borderBottomColor: (theme.vars || theme).palette.error.main, + transform: 'scaleX(1)', // error is always underlined in red }, '&:before': { borderBottom: `1px solid ${ @@ -116,7 +112,7 @@ const FilledInputRoot = styled(InputBaseRoot, { }), pointerEvents: 'none', // Transparent to the hover style. }, - [`&:hover:not(.${filledInputClasses.disabled}, .${filledInputClasses.error}):before`]: { + [`&:hover:not(.${filledInputClasses.disabled}):before`]: { borderBottom: `1px solid ${(theme.vars || theme).palette.text.primary}`, }, [`&.${filledInputClasses.disabled}:before`]: { diff --git a/packages/mui-material/src/Input/Input.js b/packages/mui-material/src/Input/Input.js index 9c908d55a8d950..fdbbed5b7b1183 100644 --- a/packages/mui-material/src/Input/Input.js +++ b/packages/mui-material/src/Input/Input.js @@ -75,13 +75,9 @@ const InputRoot = styled(InputBaseRoot, { // See https://github.com/mui/material-ui/issues/31766 transform: 'scaleX(1) translateX(0)', }, - [`&.${inputClasses.error}`]: { - '&:before, &:after': { - borderBottomColor: (theme.vars || theme).palette.error.main, - }, - '&:focus-within:after': { - transform: 'scaleX(1)', // error is always underlined in red - }, + [`&.${inputClasses.error}:after`]: { + borderBottomColor: (theme.vars || theme).palette.error.main, + transform: 'scaleX(1)', // error is always underlined in red }, '&:before': { borderBottom: `1px solid ${bottomLineColor}`, @@ -96,8 +92,8 @@ const InputRoot = styled(InputBaseRoot, { }), pointerEvents: 'none', // Transparent to the hover style. }, - [`&:hover:not(.${inputClasses.disabled}, .${inputClasses.error}):before`]: { - borderBottom: `1px solid ${(theme.vars || theme).palette.text.primary}`, + [`&:hover:not(.${inputClasses.disabled}):before`]: { + borderBottom: `2px solid ${(theme.vars || theme).palette.text.primary}`, // Reset on touch devices, it doesn't add specificity '@media (hover: none)': { borderBottom: `1px solid ${bottomLineColor}`,