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

mdc-ripple or mdc-toolbar: Ripple is being cut out #2431

Closed
pshe94 opened this issue Mar 19, 2018 · 4 comments · Fixed by #3521
Closed

mdc-ripple or mdc-toolbar: Ripple is being cut out #2431

pshe94 opened this issue Mar 19, 2018 · 4 comments · Fixed by #3521
Labels

Comments

@pshe94
Copy link
Contributor

pshe94 commented Mar 19, 2018

What MDC Web Version are you using?

0.32.0

What browser(s) is this bug affecting?

Chrome 66.0.3359.33, Edge 41.16299.248.0 (EdgeHTML 16.16299)

What OS are you using?

Windows 10 1709

What are the steps to reproduce the bug?

  1. Go to demo page of toolbar
  2. Press one of the icons in toolbar that has ripple attached to it (for example Bookmark icon)

What is the expected behavior?

Ripple should not be cut out.

What is the actual behavior?

Ripple is cut out from right and bottom side (in Chrome) and top and left side (in Edge) by 1px. In Firefox 60.0b4 this problem doesn't occur.

Chrome:
image

Edge:
image

Any other information you believe would be useful?

This problem might be related to #1753, but I'm not sure.

@acdvorak
Copy link
Contributor

I think this is a subpixel rendering issue.

--mdc-ripple-fg-size has a fractional value of 28.8px.

If you wrap the initialSize_ calculation in Math.floor(),
the resulting 28px seems to render correctly without getting cut off.

Change this line:

this.initialSize_ = maxDim * MDCRippleFoundation.numbers.INITIAL_ORIGIN_SCALE;

to this:

this.initialSize_ = Math.floor(maxDim * MDCRippleFoundation.numbers.INITIAL_ORIGIN_SCALE);

@williamernest
Copy link
Contributor

Thanks for filing this issue. We've added it to our tracker.

@acdvorak
Copy link
Contributor

This issue affects all unbounded ripples (e.g., icon-toggle).

To correct my earlier comment: There are actually two CSS properties that get multiplied together to determine the rendered size of the ripple:

--mdc-ripple-fg-size: 28.8px;
--mdc-ripple-fg-scale: 1.66667;

I'm guessing that the cutoff happens because 28.8 * 1.6666 = 47.99 which is not quite a whole number, so the browser tries to do subpixel rendering.

Surface element (48px):

image

::before pseudo-element (47.99px):

image

@touficbatache
Copy link
Contributor

Hi @acdvorak, why not have a Math.round() around 28.8 * 1.6666? It would be 48

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants