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

[TextField] Fix error focus style #35167

Merged
merged 1 commit into from Dec 20, 2022

Conversation

42tte
Copy link
Contributor

@42tte 42tte commented Nov 16, 2022

Fixes Input & FilledInput error focus state style. Fixes #35353

According to Material these should be 1px default & 2px on focus. Thus having a visible focus state.
In MUI these are currently 2px default & without any focus state.

Focus visible is an accessibility requirement by WCAG 2.4.7

@mui-bot
Copy link

mui-bot commented Nov 16, 2022

Messages
📖 Netlify deploy preview: https://deploy-preview-35167--material-ui.netlify.app/

Details of bundle changes

Generated by 🚫 dangerJS against d973845

@zannager zannager added the component: text field This is the name of the generic UI component, not the React module! label Nov 16, 2022
@42tte 42tte changed the title [Input, FilledInput] Fix error focus style [TextField] Fix error focus style Nov 16, 2022
@42tte
Copy link
Contributor Author

42tte commented Nov 18, 2022

Changes detected by argos is as expected

Comment on lines 95 to 97
[`&:before, &:hover:not(.${filledInputClasses.disabled}):before`]: {
borderBottomColor: (theme.vars || theme).palette.error.main,
},
'&:after': {
borderBottomColor: (theme.vars || theme).palette.error.main,
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this part for? looks unrelated to me.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I think I got it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to change the color on the bottom border, before focus. Without it it would flicker between blue & red on transform

'&:focus-within:after': {
  borderBottomColor: (theme.vars || theme).palette.error.main,
  transform: 'scaleX(1)', // error is always underlined in red
},

Comment on lines 95 to 97
[`&:before, &:hover:not(.${filledInputClasses.disabled}):before`]: {
borderBottomColor: (theme.vars || theme).palette.error.main,
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I rather do this instead.

// line 115
[`&:hover:not(.${filledInputClasses.disabled}):not(.${filledInputClasses.error}):before`]: {
  borderBottom: `1px solid ${(theme.vars || theme).palette.text.primary}`,
},

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, this will also fix a difference between MUI & Material on hover bottom-border width. I will push the changes.

Copy link
Member

@siriwatknp siriwatknp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check my comment.

@42tte
Copy link
Contributor Author

42tte commented Dec 13, 2022

Please check my comment.

@siriwatknp Changes done as requested. Please have a new look 🙏

Copy link
Member

@siriwatknp siriwatknp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Need final review from @oliviertassinari

Copy link
Contributor

@danilo-leal danilo-leal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good 👌

@42tte
Copy link
Contributor Author

42tte commented Dec 19, 2022

Looking good 👌

👍

@siriwatknp Could you resolve comments & update review from requested changes to approve? Would have loved to have this for Christmas 🎄

Copy link
Member

@siriwatknp siriwatknp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Thanks for your contribution!

@siriwatknp siriwatknp merged commit df49d6a into mui:master Dec 20, 2022
@oliviertassinari oliviertassinari added bug 🐛 Something doesn't work accessibility a11y labels Dec 31, 2022
oliviertassinari added a commit to oliviertassinari/material-ui that referenced this pull request Dec 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accessibility a11y bug 🐛 Something doesn't work component: text field This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[TextField] Error focus style
6 participants