React-slick: When using fade, slides are still stacked, meaning links etc on lower slides are inaccessible

Created on 4 Apr 2018  路  5Comments  路  Source: akiran/react-slick

When using the fade options, slides are not actually set to display: none their visibility and opacity is just altered. This means that which ever slide is last in the list is the one which is actually clickable. For example, create a slideshow of images with links - https://codesandbox.io/s/7j6j388070 - No matter which slide is shown, you can only ever get to the link on the last slide.

Once a slide isn't visible it needs it's display property changing so it doesn't affect the other slides and sit on top of them.

Most helpful comment

Alternate CSS workaround:

.slick-slide { pointer-events: none; }
.slick-active { pointer-events: auto; }

Though I'd like to see this fixed in the core code.

All 5 comments

I had the same issue just yesterday. I made this component as a workaround:

const ClickableEnvironmentInCarousel = ({ children }) => {
  return (
    <WhateverBoxDivThingYouUse
      position="relative"
      zIndex="1"
    >
      {children}
    </WhateverBoxDivThingYouUse>
  );
};

By wrapping that around whatever elements needed to be clickable, they would "elevated" when that carousel slide was active and thus clickable. Bit hacky, but it works until a proper fix gets implemented.

(Of course, you'll need some sort of implementation to pass the appropriate CSS position and z-index for the container div that does the elevating.)

Thanks for that. I decided it was easier just to do the following which seems to work :)

.slick-slide.slick-active { z-index: 999; }

Alternate CSS workaround:

.slick-slide { pointer-events: none; }
.slick-active { pointer-events: auto; }

Though I'd like to see this fixed in the core code.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

I have the same problem and I think the @chicgeek solution is the right one to avoid conflicts with other elements z-index.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

BradyEdgar94 picture BradyEdgar94  路  3Comments

laveesingh picture laveesingh  路  3Comments

slashwhatever picture slashwhatever  路  3Comments

briziel picture briziel  路  3Comments

enriquelopez-atlas picture enriquelopez-atlas  路  3Comments