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

CSS clip-path only works properly on first element in Safari 10 #27

Open
ryanlabar opened this issue Oct 28, 2016 · 5 comments
Open

CSS clip-path only works properly on first element in Safari 10 #27

ryanlabar opened this issue Oct 28, 2016 · 5 comments

Comments

@ryanlabar
Copy link

ryanlabar commented Oct 28, 2016

Using CSS clip-path on multiple elements using the same path only displays on first element and renders strange on, or doesn't display, the proceeding elements in Safari 10.0.

See CodePen for example: http://codepen.io/ryan_labar/pen/KgLNyx

@emilbjorklund
Copy link
Owner

Hi @ryanlabar! I've seen this bug in various forms before, and basically, Safari/WebKit has some general trouble mapping the coordinate system between the SVG and the HTML element the effect is applied to.

Luckily, there’s a fix: applying any property that forces the affected element to render in its own compositor layer seems to make Safari snap back into getting the coordinates right, thus fixing the bug.

In your example, adding e.g. transform: translateZ(0) or will-change: transform to the .clipWrap element seems to do the trick.

@rnagy90
Copy link

rnagy90 commented May 28, 2020

Still relevant on Android Chrome when used on div which have background images and contains a child svg with same path as the clip-path.

@viking2917
Copy link

Still helps in 2022, in Ionic apps using the embedded Safari. Thanks!

@emilbjorklund
Copy link
Owner

@viking2917 Glad to hear that this repo is still of use! 🙂

@blauweb
Copy link

blauweb commented Jul 28, 2023

Just came here to express my appreciation for the solution !
I wasn't using SVG, however translateZ also solved my issues, while using the clip property on a parent div :)

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

No branches or pull requests

5 participants