Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow access to native event in 'allowTouchMove' #226

Closed
wants to merge 1 commit into from

Commits on Jun 30, 2021

  1. Allow access to native event in 'allowTouchMove'

    In order to facilitate more advanced types of event detection / decision-making when allowing `touchmove` events, it is sometimes necessary to have access to the `Event` itself in certain scenarios. For example, detection of Pen / Stylus (see example below).
    
    (Currently B.S.L. breaks all stylus touches, and the only way I've figured out to fix it is to disable BSL on stylus touch events.)
    
    That may be worth a separate issue in itself, but I still think there's value in exposing the native event, since it would allow for much finer grained control over 'allowTouchMove' behavior.
    
    ```
            disableBodyScroll(mainElmt, {
              allowTouchMove: (el: HTMLElement, e: Event) => {
                const touch = e as TouchEvent;
                if (touch.touches?.[0]?.touchType === 'stylus') {
                  return true;
                }
                // ...
              },
            });
    ```
    lincolnthree authored Jun 30, 2021
    Configuration menu
    Copy the full SHA
    45f712b View commit details
    Browse the repository at this point in the history