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

[@use-gesture/vanilla] Touch event was abnormally interrupted. #664

Open
2 tasks done
mchao123 opened this issue May 8, 2024 · 1 comment
Open
2 tasks done

[@use-gesture/vanilla] Touch event was abnormally interrupted. #664

mchao123 opened this issue May 8, 2024 · 1 comment
Assignees

Comments

@mchao123
Copy link

mchao123 commented May 8, 2024

Describe the bug

console error: actions-fe213e88.esm.js:332 Unable to preventDefault inside passive event listener invocation.

Sandbox or Video

The tug event will be abnormally interrupted, and the problem only occurs on emulated devices and cell phones

<script setup lang="ts">
import { DragGesture } from "@use-gesture/vanilla";
import anime from "animejs";
import { type Directive } from "vue";


let gesture: DragGesture;

const vDarg: Directive<HTMLDivElement> = {
    mounted(el, binding, vnode, prevVnode) {
        gesture = new DragGesture(el, ({ active, movement: [mx, my],...e }) => {
            console.log(active,my,e)
            anime({
                targets: el,
                translateY: active ? my : 0,
                duration: active ? 0 : 1000
            });
        }, {
            preventDefault: true,
            filterTaps: true
        });
    },
    unmounted(el, binding, vnode, prevVnode) {
        gesture.destroy();
    }
}

</script>
<template>
    <div class="modal-bg" />
    <div class="modal" v-darg>
        test<br><br><br><br>
    </div>
</template>
<style lang="scss" scoped>
.modal-bg {
    position: fixed;
    z-index: 99;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.1);
}

.modal {
    font-size: 1.2rem;
    position: fixed;
    z-index: 99;
    box-sizing: content-box;
    padding-bottom: 40vh;
    margin-bottom: -40vh;
    bottom: 0;
    background-color: #fff;
    box-shadow: 0 0 1rem #0001;
    left: 50%;
    margin-left: -50%;
    width: 100%;
    touch-action: none
}
</style>

Information:

  • Use Gesture version: v10.3.1
  • Browser Edge、Chrome

Checklist:

  • I've read the documentation.
  • If this is an issue with drag, I've tried setting touch-action: none to the draggable element.
@mchao123 mchao123 changed the title Touch event was abnormally interrupted. [@use-gesture/vanilla] Touch event was abnormally interrupted. May 8, 2024
@mchao123
Copy link
Author

mchao123 commented May 8, 2024

It's my problem.

*{
  touch-action: none;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants