tuax/tua-body-scroll-lock

feat: support scrolling in nested elements

jochienabuurs opened this issue · 3 comments

The library currently allows only one target element to be scrollable. I have the use case where a modal contains multiple elements (sliders) that also need to be scrollable.

The body-scroll-lock library allows for this to happen through a allowTouchMove function that the user of the lib can supply to validate if the element is scrollable.

Would this be something you consider to implement?

Thank you for your issue.

For multiple elements you can use lock multiple times.

import { lock, unlock } from 'tua-body-scroll-lock'

const element1= document.querySelector('#element1')
const element2= document.querySelector('#element2')

lock(element1)
lock(element2)

Maybe add a simple demo would be better.

I think we should support multiple elements for lock and unlock.