Identify scroll coming from locking
AntoineDuComptoirDesPharmacies opened this issue · 2 comments
Is your feature request related to a problem? Please describe.
We are using window event listener on scroll
to open/collapse the website header according to user scroll up/down on the page.
When tua-body-scroll-lock
trigger, a scroll event is sent with pos_x = 0 and pos_y = 0, making the header thinking that user scroll up.
It would be nice to avoid this header effect on scroll lock.
Describe the solution you'd like
The header is not opened/collapsed when an element get scroll lock.
Two potential implementations :
tua-body-scroll
export thegetLockState
method to access thelockedNum
value. On our side we can check this value on scroll and ignore event iflockedNum
> 0.tua-body-scroll
export aisLocked
method that will do the same as '1' but with a simpletrue
/false
return.tua-body-scroll
add a special meta/key in the scroll event so we can ignore them on reception.
The (3) may be the best but do not know if it is technically feasible.
Describe alternatives you've considered
At first we were thinking to check the value of style overflow
on document
or body
but it to not work on iOS as the style is not passed to hidden
/ grid
.
So at the moment, we are using useGlobalLockState
and checking the value of window.__BSL_LOCK_STATE__?.lockedNum
,
Yours faithfully,
LCDP
Thanks for your issue, how about providing a reproduction repo or online demo? @AntoineDuComptoirDesPharmacies
Maybe export getLockState
? So you can check the lockedNum?