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

fadeToggle effect issue on Safari #4370

Open
alegout opened this issue Apr 27, 2019 · 10 comments
Open

fadeToggle effect issue on Safari #4370

alegout opened this issue Apr 27, 2019 · 10 comments
Milestone

Comments

@alegout
Copy link

alegout commented Apr 27, 2019

Description

jQuery 3.4
Safari Version 12.1 (14607.1.40.1.4)

On safari, fadeToggle "blink" but not on Chrome, any ideas?

Code: jQuery('#selector').fadeToggle()

Thank you

Link to test case

jquery-fadeToggle-blink

@mgol
Copy link
Member

mgol commented Apr 27, 2019

Can you provide a test case on JS Bin as the issue template requested? Thanks!

@alegout
Copy link
Author

alegout commented Apr 27, 2019

Hello @mgol,

Sorry, voilà

EDIT: It is happening because of the use of two fadeToggle. Maybe you have a solution?

Thank you

@mgol
Copy link
Member

mgol commented Apr 28, 2019

Thanks for the test case! I reduced the test case to not include any external JS/CSS files: https://jsbin.com/jafisol/edit?html,css,js,output

Note: to reproduce it reliably, pop-out to a preview mode: https://output.jsbin.com/jafisol. In the default iframed view the issue doesn't always appear for me in Safari 12.1.

@mgol
Copy link
Member

mgol commented Apr 28, 2019

The issue is reproducible in Safari 12.1 since jQuery 3.2.0. The first bad commit: 6d43dc4 (cc @markelog).

@farazhashmi21
Copy link

farazhashmi21 commented Apr 28, 2019 via email

@Manuel-Suarez-Abascal
Copy link

@mgol @farazhashmi21 @alegout I have tried in IE11 OS: Window 10 and it blinks as well. Any ideas how to fix this? I would like to work on it.

@mgol
Copy link
Member

mgol commented May 1, 2019

@Manuel-Suarez-Abascal Thanks for the info! I confirm it's broken in IE 11 in the same way and that the same commit, 6d43dc4, that broke Safari is also the first to break IE.

I don't know what's the correct fix. If you want to try, have a look at what commit 6d43dc4 changed & try to tweak relevant code until the test case in IE or Safari stops flickering.

@mgol
Copy link
Member

mgol commented May 1, 2019

I investigated it a little; I thought this is just a browser issue in IE & Safari but it turns out it's more complex. If you set window.requestAnimationFrame to null to force jQuery to go through window.setTimeout the issue is present in all browsers, including Chrome & Firefox:
https://jsbin.com/povatol/1/edit?html,css,js,output

And if you revert 6d43dc4, the issue goes away in all of them. It might be that Chrome & Firefox are just doing more optimizations in requestAnimationFrame that are avoiding this issue but it seems to be there.

We should fix that.

@Manuel-Suarez-Abascal
Copy link

@mgol Thanks for the info! I will work on it and see if I can fix this.

@timmywil timmywil added this to the 3.4.2 milestone May 6, 2019
@alegout
Copy link
Author

alegout commented Dec 20, 2019

It seems to be fixed / not happening anymore.
Tried on Safari 13.0.4.

@mgol mgol modified the milestones: 3.5.0, 3.6.0 Mar 16, 2020
@mgol mgol modified the milestones: 3.6.0, Future Dec 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

5 participants