akiran / react-slick

React carousel component
http://react-slick.neostack.com/
MIT License
11.76k stars 2.11k forks source link

When using fade, slides are still stacked, meaning links etc on lower slides are inaccessible #1167

Open ghost opened 6 years ago

ghost commented 6 years ago

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.

VinceSJ commented 6 years ago

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.)

ghost commented 6 years ago

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

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

chicgeek commented 6 years ago

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.

stale[bot] commented 5 years ago

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.

marioelo commented 5 years ago

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

lamellama commented 3 years ago

This is still happening but thanks chicgeek

elkelk commented 2 years ago

This issue has reappeared after being fixed previously: https://github.com/akiran/react-slick/issues/852.