FormidableLabs / FormidableLabs/react-swipeable

Difficulties with swipe on container with inner and outer click events

オープン
#336 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
TypeScript
スター
2.1k
フォーク
149
PR マージ指標
30日以内にマージされた PR はありません

説明

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

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

リンク先のCodeSandboxでインタラクションを再現します。src/InnerClickTriggersTap.tsx の21行目から開始してください。外側のスワイプおよびクリックの挙動と、内側のボタンのクリックおよび伝播処理を比較します。スワイプでアイテムのクリックアクションが発生せず、内側のボタンをクリックしても外側の onTap アクションが同時に発生しなければ完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
react, typescript
領域
frontend
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
30/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。