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 media hover specificity issue #16266

Merged
merged 3 commits into from
Jun 18, 2019

Conversation

arminydy
Copy link
Contributor

@arminydy arminydy commented Jun 17, 2019

Closes #16149

Highlight TextField varient outlines border color on focus event on mobile

-Desc: highlight TextField varient outlines border color on focus event on mobile
@mui-pr-bot
Copy link

mui-pr-bot commented Jun 17, 2019

Details of bundle changes.

Comparing: c0e4103...4965b02

bundle parsed diff gzip diff prev parsed current parsed prev gzip current gzip
@material-ui/core +0.01% 🔺 0.00% 318,982 319,010 87,573 87,576
@material-ui/core/Paper 0.00% 0.00% 68,281 68,281 20,353 20,353
@material-ui/core/Paper.esm 0.00% 0.00% 61,578 61,578 19,133 19,133
@material-ui/core/Popper 0.00% 0.00% 28,968 28,968 10,411 10,411
@material-ui/core/Textarea 0.00% 0.00% 5,513 5,513 2,374 2,374
@material-ui/core/TrapFocus 0.00% 0.00% 3,755 3,755 1,580 1,580
@material-ui/core/styles/createMuiTheme 0.00% 0.00% 16,012 16,012 5,791 5,791
@material-ui/core/useMediaQuery 0.00% 0.00% 2,597 2,597 1,102 1,102
@material-ui/lab 0.00% 0.00% 140,580 140,580 43,454 43,454
@material-ui/styles 0.00% 0.00% 51,703 51,703 15,337 15,337
@material-ui/system 0.00% 0.00% 15,303 15,303 4,342 4,342
Button 0.00% 0.00% 84,279 84,279 25,630 25,630
Modal 0.00% 0.00% 20,345 20,345 6,689 6,689
Slider 0.00% 0.00% 74,681 74,681 23,221 23,221
colorManipulator 0.00% 0.00% 3,904 3,904 1,544 1,544
docs.landing 0.00% 0.00% 55,232 55,232 13,946 13,946
docs.main 0.00% 0.00% 651,051 651,051 205,054 205,054
packages/material-ui/build/umd/material-ui.production.min.js +0.01% 🔺 0.00% 292,226 292,254 83,498 83,501

Generated by 🚫 dangerJS against 4965b02

-Desc: highlight TextField varient outlines border color on focus event on mobile
@oliviertassinari oliviertassinari changed the title -ticket: https://github.com/mui-org/material-ui/issues/16149 [TextField] Fix media hover specificity issue Jun 17, 2019
@oliviertassinari oliviertassinari added bug 🐛 Something doesn't work component: text field This is the name of the generic UI component, not the React module! labels Jun 17, 2019
Copy link
Member

@joshwooding joshwooding left a comment

Choose a reason for hiding this comment

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

Tested on mobile, works for me

@oliviertassinari
Copy link
Member

oliviertassinari commented Jun 17, 2019

The current approach outputs the following CSS:

.MuiOutlinedInput-root:hover .MuiOutlinedInput-notchedOutline { /* Specificity = 3 */
  border-color: rgba(0, 0, 0, 0.87);
}
.MuiOutlinedInput-root.Mui-focused .MuiOutlinedInput-notchedOutline { /* Specificity = 3 */
  border-color: #2196f3;
  border-width: 2px;
}
@media (hover: none) {
  .MuiOutlinedInput-root:hover .MuiOutlinedInput-notchedOutline:hover .MuiOutlinedInput-notchedOutline { /* Specificity = 5 */
    border-color: rgba(0, 0, 0, 0.23);
  }
}

I have updated the pull request to use the patch proposed in the GitHub issue. It outputs the following CSS:

.MuiOutlinedInput-root:hover .MuiOutlinedInput-notchedOutline { /* Specificity = 3 */
  border-color: rgba(0, 0, 0, 0.87);
}
@media (hover: none) {
  .MuiOutlinedInput-root:hover .MuiOutlinedInput-notchedOutline { /* Specificity = 3 */
    border-color: rgba(0, 0, 0, 0.23);
  }
}
.MuiOutlinedInput-root.Mui-focused .MuiOutlinedInput-notchedOutline { /* Specificity = 3 */
  border-color: #2196f3;
  border-width: 2px;
}

Notice how the specificity is minimized and the style rule order is correct.

@oliviertassinari
Copy link
Member

@arminydy It's a great first pull request on Material-UI 👌🏻. Thank you for working on it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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 variant outlined's border color doesn't change when focus on mobile
4 participants