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
Flickering in Safari #3527
Comments
|
Have fixed it by adding: However, yes, I think it would be good if it gets fixed. |
|
This bug is reproducible on every Swiper installation, including the latest Swiper 5.3.7, on iOS Safari 13.4.1, even reproducing on swiperjs.com.
It's been mentioned both in that recent issue and I believe this StackOverflow post, too. I spent 45 minutes tracking down this bug. :( Thank you for offering a workaround, but either the root cause fix or this workaround should ideally be pushed to a public release. I can't imagine we are the only ones who've noticed this. |
|
After some testing, this workaround ( Alas. |
|
I took the video frame by frame. It seems like, when it flickers once on a certain slide, it will flicker again exactly at that slide location. The flicker = a portion of the slide is sliced off, revealing the element behind Some examplesFormat of 7.02 / 9.07 / 12.03 / 13.11 set7 sec, 02 frame (see the slice location)12 sec, 03 frame (same as above!)9 sec, 7 frame (again, same)13 sec, 11 frame (again, same)21.21 / 29.04 / 30.04 / 31.04 set21 sec, 21 frame29 sec, 04 frame30 sec, 04 frame31 sec, 04 frameThere are more examples, but this post is probably illustrative enough. |
|
I can confirm the bug remains in the latest 5.3.8 update released today and still reproduces perfectly on swiperjs.com. Tomorrow, I'll see what Safari's debugging can share. I may have misunderstood the hardware inclination, but I don't think this is hardware-specific. I can reproduce it reliably in iOS 13.4.1 (iPhone 6S Plus), while @ertdfgcvb can reproduce it on macOS 10.14.6 (presumably a laptop/desktop). |
|
I think this is not a swiper issue: I'm able to reproduce this flickering on Safari (mobile and desktop) just with simple horizontal scrolling (meanwhile I wrote my own "swiper", partly to see if I was able to overcome this issue)… |
|
Interesting. On every horizontal scrolling site on my iOS device, there are zero flickers. A few horizontal scrolling test sites; to confirm, you're seeing flicker on all of these?
I saw no flicker on the above sites whatsoever. SwiperJS remains flickery: I can even trigger it on the blank slide demos, though it's much worse on image-based slides. |
|
Related issue on webkit community Note: seems issue partially gone with disabled Web Animations API |
|
Likely only appropriate for simpler Swiper implementations. |
where to put cssMode:true ?? |
@ieozt38 add this as a parameter, like this:
More info in the docs, under "CSS Scroll Snap". |
Thank you very much but sadly the behaviour changes too much with that property :( |
|
I've done some limited testing and this issue looks to be fixed for me on Swiper 6.1.3 and iOS 13.6.1. I'm using an iPhone 6s Plus on the default Safari browser. I can no longer reproduce it on https://swiperjs.com/demos/ nor on my own internal sites. I can swipe slowly, quickly, etc.: no flicker, no blackouts, no jittery splicing. Looks as smooth as can be and is a far more reliable & consistent experience. Notably, I am not using CSS mode: just the default JS-based animations. |
I can confirm that with the swiper 6.1.2 release the bug has been (fixed) tested devices -> |
I'm not seeing the issue in iOS 14, however, it is still present in Safari in macOS Big Sur, although I could argue it's happening less often than before. |
|
My GOD! it's working!!! |
|
I started using swiper a couple of days ago and I noticed the bug very soon. I'm on swiper 6.3.4 and iOS 14.0.1 and iPhone XS |
|
I use Swiper from CDN. I experience the image flicker when panning a zoomed image on iOS and Android web browsers (for Android, this happened much less on the Chrome browser than the default Samsung browser). Looks to me like it's doing a re-draw every time you pan the image. Maybe more of an issue with high res images? |
I also encountered this issue on Safari macOS Big Sur.
this one helped |
|
I experience the problem consistently over the last years, with every new version of macOS, Safari, Swiper. |
|
#3641 may be related. .swiper-slide{
-webkit-backface-visibility: hidden;
-webkit-transform: translate3d(0,0,0);
}
.swiper-wrapper{
-webkit-transform-style: preserve-3d;
} |
|
@tiadaguru @ieozt38 @guyr989 I see that it was working properly for you in |
|
Same issue on macOS Safari 14. Seems to be fixed by:
|
|
same flicker problem on desktop Chrome 87.0.4280, maybe #3641 can fix this problem. |
|
I have still the problem with flickering slides in Safari. As in the video… |
|
Not a universal one, no. It seems likely that any existing solutions suggested so far will only fix specific types of situations and that unique use-cases and browser combinations won't be addressed by a single solution. Try to experiment with applying the tricks to different parts of your DOM and see what happens. |
My apologies for the long delay. Unfortunately, I no longer have the iPhone 6S Plus. I've re-tested on an iPhone 12 Pro on iOS 14.6 in Safari, with the swiperjs.com/demos build (Thumbs Gallery again; I presume 6.6.2) and the bug does not reproduce there. Would anyone with an iPhone 6S be able to check? |
|
@vltansky I can confirm that it improves the flickering situation. But wouldn’t say that it solves it completely. Without, I have the flickering with every slide, using this hack maybe only every 5th or 10th slide. .swipe-slide {
-webkit-backface-visibility: hidden;
-webkit-transform: translate3d(0,0,0);
}
.swiper-wrapper {
-webkit-transform-style: preserve-3d;
} |
|
As of today, the problem was still present in version 6.7.1.
|
|
Confirming this bug using the latest swiper version (6.8.1) on an iPhone 7 with iOS 14. cssMode solves the flickering, but we need the zoom functionality for our app. Will try to find a different solution. EDIT: I must have messed up the various solutions; After only adding |
This worked for me, even on older versions. I've tested in v4.3.3 and v6.0.4 on the iPhone 8 Plus (14.6) |
|
I was redirected to this issue from #5180 but I don't think that those problems are actually duplicates. The suggested solutions from this thread don't work for me. |
|
Hey I'have the same issue on macos and safari. Can confirm that this flickering thing is still a issue. Anyone any ideas how to fix that problem? Kind regards, Is it possible, that this issue is because of the effect cube? Or which effect do you guys use? |
another improvement in besides this is to disable followFinger. |
|
below worked perfectly for me when using Safari. I hope the same should work with you to stop Flickering in Safari .
|
|
looks like adding solving the issue .swiper-slide{
trasnform: translateZ(0);
}@nolimits4web what do you think? @media screen and (min-color-index:0) and(-webkit-min-device-pixel-ratio:0)
{ @media {
/*
Define here the CSS styles applied only to Safari browsers
(any version and any device)
*/
}}https://solvit.io/bcf61b6 |
|
Latest Hardware, latest Version of Safari and Swiper, all the CSS hacks discussed above in place, the flickering remains. When I use the autoplay module, the flickering appears with every slide, otherwise it’s only every nth :( When I use Will this ever be fixed? I do see other sliders on the web that don’t have flickering... Is it time to look for another solution? |
|
Do you have an example URL where you can still see flickering after adding the translateZ(0); solution on the slides? I'm testing it now across lots of devices and it solves it for me. Interested to see where it fails. If I apply this to the demos on the swiper site using dev tools it also fixes it for me. |
Chiming in re: performance penalty, which in my case (75 full-screen slides with jpegs) was so bad that it either crashed the browser (mobile Safari on iPad, iOS 15.1) or, with slide count halved, effectively prevented any animation. |
|
Just adding some extra info here that I found while troubleshooting.. Not solutions, but gives some insight into the problem.
(Notice that even the 20 slides full width works well on mobile Safari, probably because much less width to the slider due to the smaller viewport width, but on desktop it struggles) Some tests.. (bright coloured backgrounds are so the flickering would be more visible if it was happening) 20 full screen slides - https://codepen.io/wplit/full/RwjNxxa [struggles] In all cases the flicker is gone, it's just a case of performance. If we could find a solution to the overflow issue mentioned above, this would prevent the need to put slides on new layers and would remove the performance issue. |
|
@wplit https://codepen.io/vltansky/pen/rNYVBJa |
|
@vltansky Kind regards, |
|
@vitansky Still seeing performance issue, but I don't think it can be avoided. Obv 20 full screen slides is an extreme scenario, so this solution will solve it for 95-99% of use cases i would have thought. |
|
Swiper v8 released with new option https://swiperjs.com/swiper-api#param-maxBackfaceHiddenSlides |
|
I now have the impression that this reduces the flickering a little bit (only every 3rd-5th instead of every slide): .swipe-slide {
-webkit-backface-visibility: hidden;
-webkit-transform: translate3d(0,0,0);
}
.swiper-wrapper {
-webkit-transform-style: preserve-3d;
}while the following reduces the flickering even more (maybe every 10-20th): .swiper-slide {
-webkit-backface-visibility: hidden;
-webkit-transform: translateZ(0);
}
.swiper-wrapper {
-webkit-transform-style: preserve-3d;
-webkit-transform: translateZ(0);
} |
|
I tried using all the suggested changes however nothing fixed it. It works fine on desktop, even with small viewports. I've removed as much other code as possible to see if it was caused by something I'd done but nothing seems to have improved. Dragging the slide to switch to the next one isn't an issue, however when I stop dragging on it (aka stop touching the screen with my finger) it doesn't transition to the next slide, instead it waits some time then replaces the current one with the next one... |
|
One solution is to apply However, when the user navigates to a faraway slide (e.g. from the last slide back to the first slide) this solution could cause performance issues. In this case, the |










This is a (multiple allowed):
bug
enhancement
feature-discussion (RFC)
Swiper Version: Swiper 5.3.6
Platform/Target and Browser Versions: macOS 10.14.6, Safari 13.1
What you did
In safari there is a brief flicker when the swipe animation ends. This can result in a very annoying experience. I noticed that there was a similar issue (#3124) flagged as "outdated".
It seems hardware related.
Workaround
Added
-webkit-transform: translate3d(0, 0, 0);to the.swiper-slideclass as suggested here.The
-webkitprefix guarantees that the fix is effective only on Safari.Strangely it seems that the added 3d transform on this class disables the hardware acceleration as the transition appears less smooth (might be an impression).
The text was updated successfully, but these errors were encountered: