FormidableLabs / nuka-carousel

Small, fast, and accessibility-first React carousel library with an easily customizable UI and behavior to fit your brand and site.
https://commerce.nearform.com/open-source/nuka-carousel
Other
3k stars 596 forks source link

fix: only include inert property when slide is not in view #1000

Closed allypalanzi closed 1 year ago

allypalanzi commented 1 year ago

Description

Currently, inert is applied to every slide, which is causing issues if slides have interact-able elements on them. When a slide is in view, we are setting inert="false" which is basically still applying the inert property.

Instead we need to not have the inert property at all when the slide is in view.

Fixes #999

Type of Change

How Has This Been Tested?

Verified in Storybook that the active slide does not have inert set Screen Shot 2023-03-13 at 5 37 37 PM

Checklist

vercel[bot] commented 1 year ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
nuka-carousel ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Mar 14, 2023 at 4:04PM (UTC)
allypalanzi commented 1 year ago

@carlos-kelly would love to get this released so i can finally upgrade to nuka v5 🙏🏻

Panzki commented 1 year ago

Hi, we ran into this problem as well. The HTML spec states that "The inert attribute is a boolean attribute that indicates, by its presence, [...] are to be made inert by the user agent." (see here) Setting inert to false does not disable the inert state of the slide, inert has to be absent. When testing this behavior make sure to not use FireFox, because FireFox does not support inert (yet): https://caniuse.com/?search=inert

The fix looks good to me. I'd welcome an additional regression test. It would be nice if you could rollout the fix soon.

In the meantime we worked around the problem by downgrading the package to version 5.4.1. The bug was introduced in version 5.5.0 (this commit)

allypalanzi commented 1 year ago

unfortunetly i need the fixed width slides in 5.5 😭