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

[Divider] Inconsistent height on scaled screen #14815

Closed
urirahimi opened this issue Mar 10, 2019 · 3 comments · Fixed by #18965
Closed

[Divider] Inconsistent height on scaled screen #14815

urirahimi opened this issue Mar 10, 2019 · 3 comments · Fixed by #18965
Labels
bug 🐛 Something doesn't work component: divider This is the name of the generic UI component, not the React module!

Comments

@urirahimi
Copy link

urirahimi commented Mar 10, 2019

The divider behavior in my code sandbox is weird. Sometimes is shows up thicker and sometimes they don't even show up. This can be reproduced by cmd+/- on mac to adjust the zoom on your browser. Please see screenshots attached for examples.

Expected Behavior 🤔

Current Behavior 😯

Steps to Reproduce 🕹

https://codesandbox.io/s/mmnoyvq9oy

Context 🔦

Just trying to make my dialogs work in a few different contexts

Your Environment 🌎

Tech Version
Material-UI v3.9.1
React 16.8.4
Browser Chrome

Screen Shot 2019-03-09 at 7 17 40 PM
Screen Shot 2019-03-09 at 7 17 49 PM

@oliviertassinari
Copy link
Member

oliviertassinari commented Mar 10, 2019

@urirahimi You are forcing Chrome to do subpixel calculation, and this usually has strange behaviors.
You can mitigate the problem with:

const theme = createMuiTheme({
  overrides: {
    MuiDivider: {
      root: {
        marginTop: 1,
      },
    },
  ),
});

I have tried changing the implementation from background color to border top, it doesn't help.
https://stackoverflow.com/questions/12547580/borders-disappear-in-chrome-when-i-zoom-in

@DanielZara
Copy link

DanielZara commented Apr 23, 2019

Try to increase browsers zoom to 90 or 100 percent. Magic

@DrPhil
Copy link
Contributor

DrPhil commented Sep 16, 2019

Caveat: I am still on version 3.9.2 and have only tested on Firefox and Chrome.

Using thin as the border thickness fixed the problem for me. It lets the browser decide the thickness. On Chrome thin is chosen to be 1px / zoom. - meaning it will always stay exactly 1 real pixel regardless of zoom-level. Firefox does the same when zooming out, but will make the border 2 real pixels when >=200% zoom, 3 real pixels when >=300% zoom etc.. Unfortunate that they don't behave the same, but at least both behaved better with thin than with 1px.

const theme = createMuiTheme({
  overrides: {
    MuiDivider: {
      root: {
        // Dividers not consistent when zooming.
        // https://github.com/mui-org/material-ui/issues/14815
        borderTop: 'thin solid rgba(0, 0, 0, 0.12)', //this color should be theme.palette.divider if that is set
        backgroundColor: undefined,
        height: undefined,
      },
    },
  ),
});

@oliviertassinari oliviertassinari added the component: divider This is the name of the generic UI component, not the React module! label Dec 25, 2019
@oliviertassinari oliviertassinari changed the title Divider Not Working (Rarely showing up) [Divider] Inconsistent height on scaled screen Dec 25, 2019
@oliviertassinari oliviertassinari added bug 🐛 Something doesn't work and removed discussion labels Dec 25, 2019
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: divider This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants