material-ui icon indicating copy to clipboard operation
material-ui copied to clipboard

[Button] text rerender glitch when focusing TextField inside the same component

Open Zuurkern opened this issue 9 years ago • 8 comments

Problem description

mui_button_rerender_glitch

Versions

  • Material-UI: 1.0.0-alpha.1
  • React: 15.4.2
  • Browser: Chrome 56.0.2924.87 (64-bit)

Zuurkern avatar Feb 07 '17 16:02 Zuurkern

@Zuurkern what are we supposed to be looking for in your gif ?

Edit: NVM, see it now. Can you post your code?

mbrookes avatar Feb 07 '17 23:02 mbrookes

Haha yeah it's barely noticeable, especially on a hidpi screen.

Sorry for not posting code earlier.

const LoginPage = ({ t }) => {
  return (
    <Paper zDepth={2}>
      <TextField
          id="password"
          type="password"
          label={t('password')}
        />
      <Button raised primary>{t('log in')}</Button>
    </Paper>
  );
};

Zuurkern avatar Feb 08 '17 11:02 Zuurkern

Problem lies within rendering engine of chrome (note, firefox is ok as for my observations). And its composite layers. scale(x) is animated as a bitmap for performance reasons, and its the cause of that pixelization and blur. It somehow affects even button below, but i dont know why.

Easy fix is to create separate composite layer, which can be forced by translating in 3d space, via transform: translateZ(0) to the Button. (EDIT: it works even when settings this on FormControl- which is parent html element of the element with animation)

Question is, how to approchat the fix? forcing new composite layers for all (public) components?

Relevant stackoverflows: http://stackoverflow.com/questions/32034574/font-looks-blurry-after-translate-in-chrome http://stackoverflow.com/questions/15464055/css-transition-effect-makes-image-blurry-moves-image-1px-in-chrome

ArcanisCz avatar Feb 08 '17 18:02 ArcanisCz

@Zuurkern As you can see from closed pull request, material-ui will not implement fix for this which would mean accepting potential performance problems as a tradeof for probably only temporary chrome problem.

If you want to fix it in your application, i suggest applying will-change: transform to Buttons, which might cause problems in big application with many buttons.

ArcanisCz avatar Feb 09 '17 23:02 ArcanisCz

@ArcanisCz Thanks for figuring it out! Let's hope the Chrome team fixes this problem soon. I had similar issues with blurry elements some time ago when styling dialogs, drove me nuts. Didn't think this issue was related. Thanks for providing a temporary fix.

Zuurkern avatar Feb 10 '17 09:02 Zuurkern

Hi, @Zuurkern, can you give a link to bug report chrome(this case)?

mackva avatar Feb 21 '17 05:02 mackva

@mackva I believe it's this one: https://bugs.chromium.org/p/chromium/issues/detail?id=573146

Zuurkern avatar Feb 21 '17 09:02 Zuurkern

Related to #7010

kybarg avatar May 30 '17 21:05 kybarg