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

getComputedStyle(...) is null #4337

Closed
bbaki opened this issue Mar 16, 2021 · 3 comments
Closed

getComputedStyle(...) is null #4337

bbaki opened this issue Mar 16, 2021 · 3 comments

Comments

@bbaki
Copy link

bbaki commented Mar 16, 2021

Hi,
We get this strange error inside appSignal which I was able to track down as a Firefox bug see. I was unable to reproduce this issue locally but this seems like a possible solution, that is, replace all window.getComputedStyle (found in 2 places: updateSlides.js and utils.js) with this function:

function getComputedStyle(element, prop) {
  if (element.currentStyle) {
       return element.currentStyle[prop];
   } else if (window.getComputedStyle && window.getComputedStyle(element, null)) {
       return window.getComputedStyle(element, null).getPropertyValue(prop);
   } else {
       return element.style[prop];
   }
}

Something to point out is that the app uses React 16.8.0 with custom SSR.

Environment

  • Swiper Version: swiper@^5.2.0 resolved as version "5.4.5"
  • Some example environments that got that error: Windows 10, Mozilla Firefox 86.0 / Windows 10, Mozilla Firefox 63.0 / Windows 7, Mozilla Firefox 86.0 / Windows 8.1, Mozilla Firefox 86.0 / Linux, Mozilla Firefox 63.0 / Windows 7, Mozilla Firefox 75.0 / Windows 10, Mozilla Firefox 78.0

Expected Behavior

No error being thrown

@nolimits4web
Copy link
Owner

Swiper a while ago on version 6. Does it happen with Swiper v6?

@bbaki
Copy link
Author

bbaki commented Mar 16, 2021

I would need to update and deploy the latest version to production to be sure but window.getComputedStyle is still used inside the codebase so I would assume so. If you want however, I can give it a try.

@nolimits4web
Copy link
Owner

you anyway need to update to v6 because v5 is not maintained anymore

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

No branches or pull requests

2 participants