FormidableLabs / FormidableLabs/react-swipeable

Difficulties with swipe on container with inner and outer click events

Abierto
#336 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
TypeScript
Estrellas
2.1k
Forks
149
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

So here is my use case I got some list items that expand on click and they wrap another button. The item itself is swipeable (swiped to left should delete the item). I got this to work but I recognized that swiping also triggers the on click event of my item (case 1 in my sandbox). After some research I thought that onTap could solve this issue. Which it did but it also causes another issue: the inner click also trigger the onTap event even when I stop the propagation of the onClick. This makes sense but I am having a hard time finding a solution for this use case which is not very exotic in my opinion.
Here is the sandbox I am thankful for every answer :)
https://codesandbox.io/p/sandbox/react-swipeable-image-carousel-forked-xv4xjk?file=%2Fsrc%2FInnerClickTriggersTap.tsx%3A21%2C9

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Reproduce la interacción en el CodeSandbox enlazado, comenzando por src/InnerClickTriggersTap.tsx en la línea 21. Compara el comportamiento de deslizamiento y clic del elemento externo con el manejo del clic y la propagación del botón interno. Se considera terminado cuando deslizar no activa la acción de clic del elemento y hacer clic en el botón interno tampoco activa la acción onTap externa.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
react, typescript
Área
frontend
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Necesita aclaración
Aptitud para principiantes
30/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.