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

Visibility not updated on revealed elements in IE 11 #534

Open
alexroper opened this issue Apr 13, 2021 · 3 comments
Open

Visibility not updated on revealed elements in IE 11 #534

alexroper opened this issue Apr 13, 2021 · 3 comments

Comments

@alexroper
Copy link

The example used on the User Experience page to "Prevent Flickering" suggests adding a "visibility: hidden" style to items that will transition, but this isn't working in IE 11. ScrollReveal doesn't seem to update the visibility on revealed elements in IE 11.

The problem can be seen in your example demo: https://jsbin.com/fuvusofere/edit?html,css,output

I ran this thru WebPageTest to confirm it wasn't just my local setup that had the issue.

https://www.webpagetest.org/result/210413_AiDc2R_dc0e38e7c29f55599d9512320d9ec0c5/

GIF demo from WebPageTest

Environment

  • Operating System: Windows 10
  • Browser Version: IE 11
  • ScrollReveal Version: 4.0.9
@jlmakes
Copy link
Owner

jlmakes commented Apr 19, 2021

Thanks for the report. Looks like something here isn't working with IE11, in that visibility: visible isn't being applied.

/**
* Generate inline styles
*/
const inline = {}
const inlineStyle = element.node.getAttribute('style') || ''
const inlineMatch = inlineStyle.match(/[\w-]+\s*:\s*[^;]+\s*/gi) || []
inline.computed = inlineMatch ? inlineMatch.map(m => m.trim()).join('; ') + ';' : ''
inline.generated = inlineMatch.some(m => m.match(/visibility\s?:\s?visible/i))
? inline.computed
: [...inlineMatch, 'visibility: visible'].map(m => m.trim()).join('; ') + ';'

Which at first glance suggests that line 27: inlineMatch.some(m => m.match(/visibility\s?:\s?visible/i)) is returning true in IE11. I'll look into refactoring this, this isn't the first time string parsing and working directly with the style attribute has caused bugs.

@duncanheffron
Copy link

Hi, I just came across the same issue. I tried doing a hot fix for now by doing it through the opacity, but then the same issues occurs. Maybe some how on IE besides getting the inline styles the javascript also receives the styles originally set in the css file. Probably this results in returning the true, and why it's not setting the inline styles.

Maybe this helps in researching a solution.

@dijkermans
Copy link

Is visibility:visible not applied or doesn't it overrule the css? Adding !important to the inline style may work.

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

4 participants