On a fresh install of the varbase distribution (8.x-7.2) I created three heroslider content entities, each with an embedded image.

The heroslider images were not displayed to an anonymous user, although there was a blank space where they should be.

The images were displayed to a logged in user who had a role of "Content admin" or more privileged.

Turning javascript aggregation OFF allows the images to be displayed to anonymous users.

The problem appears to be that the aggregated javascript causes all images in the heroslider (or really slick) display to be marked as "hidden"

Comments

jlscott created an issue. See original summary.

rajab natshah’s picture

Status: Active » Needs work

Thank you James for reporting :)

Confirmed!

The issue with aggregated javascript of the slick and blazy libraries.

It is a popular issue that when we aggregate JavaScript we could run-into this type of issues
As a #TEMP fix for this issue we could stop aggregating JavaScript and only aggregate CSS

I hope that we could find a stable fix for this issue

We may be have a use of the same name of object or variables in 2 libraries
we could think of playing with an isolated JQuery context in Drupal.

rajab natshah’s picture

Some finding

https://www.drupal.org/docs/8/theming/adding-stylesheets-css-and-javascr...

preprocess Whether the assets should be aggregated.
Default: true

{ preprocess: false }

We could test on adding preprocess: false to some js libraries in the following modules.

Slick libraries

https://git.drupalcode.org/project/slick/blob/8.x-2.x/slick.libraries.yml

Blazy libraries

https://git.drupalcode.org/project/blazy/blob/8.x-2.x/blazy.libraries.yml

They do have minified: true for number of minified files, it could be that we do have the same minified name in drupal and the already minified libraries.

jayelless’s picture

@RajabNatshah Thanks for picking this up so quickly. Unfortunately I am not particularly skilled in javascript so cannot help much with finding a solution for this issue. Happy to test and confirm when you have a suggestion, but in meantime I will leave javascript aggregation turned off.

rajab natshah’s picture

Title: Heroslider images hidden for anonymous users » [Javascript aggregation ON] Heroslider images hidden for anonymous users
joebest’s picture

I recently opened a similar issue 3113972. What worked for me was granting permissions "access contextual links and view media" to anonymous. What I don’t know if such permissions would cause security issues.

I also did a search on D8 view media permission and turns out there’s seems to be an on going debate on having that permission turn on by default.

Titus Rukenya’s picture

I had this issue with varbase 8.5 .
Solution: change the access permission of the media Hero slider on the structures views , change it into "view-media"

rajab natshah’s picture

Version: 8.x-7.x-dev » 9.0.x-dev
rajab natshah’s picture