tech-systems / panes

🎉📱 Create dynamic modals, cards, panes for your applications in few steps. One instance – Thousands solutions. Any framework and free.
https://panejs.com
MIT License
687 stars 40 forks source link

[BUG] `fastSwipeClose` should clear this.steps before returning #180

Closed rgoldiez closed 2 years ago

rgoldiez commented 2 years ago

Describe the bug We have a pane with all three breakpoints set. fastSwipeClose={true} is also set. When the pane is presented and the user interacts with content on the pane (tap to focus on an input field, tap somewhere else, etc) and then swipes down from the top to dismiss, the pane closes (as expected) but subsequent presentation of the pane immediately dismiss on the first interaction (tapping on the content).

To Reproduce Steps to reproduce the behavior (see code pen example below):

  1. Create a pane with all 3 break points
  2. Make sure fastSwipeClose={true} is set
  3. Present the pane to the middle or top break and engage with the contents of the pane (click in the content area)
  4. Fast swipe to close from the top area of the pane and the pane closes
  5. Present the pane again and click in the content area again
  6. Pane immediately closes on first touch

Expected behavior Pane should only close by fast swiping, not by merely touching after a fast swipe has completed.

Additional context I believe the issue can be found in this if condition which returns on a fastSwipeClose. If the steps array was cleared before returning, the issue I'm experiencing goes away. https://github.com/roman-rr/cupertino-pane/blob/07f9d74cac5f71fd1bee10fa49a9b2b8280054f1/src/events.ts#L366

Here's a code pen demonstrating the issue: https://codepen.io/rgoldiez/pen/wvydzja

roman-rr commented 2 years ago

@rgoldiez should be fixed at master.

rgoldiez commented 2 years ago

@roman-rr - works great..... thanks!