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

Error while witching between elements of different "type" in a gallery #366

Open
1 of 3 tasks
sayontan opened this issue Jul 20, 2018 · 0 comments
Open
1 of 3 tasks

Comments

@sayontan
Copy link

What kind of issue is this? (put 'x' between the square brackets)

I have been using Featherlight for a WordPress plugin Photonic that is available to the public for free. So far I haven't had an issue adapting the script to any of my scenarios, but I believe I have come across something that is causing Featherlight to break.

Fiddle: http://jsfiddle.net/JNsu6/722/

Scenario:

  1. If I have a mixed gallery with images and videos, and I mark every element of the gallery with an explicit data-featherlight-type, when I try to click on an element, it opens up fine. However, if I click on an image and then click left / right to go to a video, I get a JavaScript error saying "Uncaught TypeError: Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'." as soon as I encounter the video.
  2. If, however, I drop the definition of data-featherlight-type="image" and just leave alone the ones that have video, this works fine.

I have verified that the behavior documented above is consistent if I switch to a different type instead of video (like wrapping the video in an HTML element and presenting it).

The reason I need to be able to do this is because my plugin is adding support for the new Google Photos API. Google Photos URLs don't have extensions, and if I try to pass a Google Photos URL as is, Featherlight reports "No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://xyz.org' is therefore not allowed access." If I explicitly define data-featherlight-type="image" or data-featherlight-type="video" then the "No 'Access-Control-Allow-Origin'" error goes away, but I am hit with the error in the JSFiddle when I try to transition to a video.

Hope this makes sense. I will be happy to provide more details if required.

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

1 participant