FormidableLabs / FormidableLabs/react-swipeable
Difficulties with swipe on container with inner and outer click events
- Vorherrschende Sprache
- TypeScript
- Sterne
- 2.1k
- Forks
- 149
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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
Beitragsleitfaden
Rechercherichtung
Reproduziere die Interaktion im verlinkten CodeSandbox, beginnend bei src/InnerClickTriggersTap.tsx in Zeile 21. Vergleiche das Wisch- und Klickverhalten des äußeren Elements mit dem Klick- und Propagationsverhalten der inneren Schaltfläche. Als abgeschlossen gilt, dass das Wischen nicht die Klickaktion des Elements auslöst und ein Klick auf die innere Schaltfläche nicht zusätzlich die äußere onTap-Aktion auslöst.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- react, typescript
- Bereich
- frontend
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 30/100