ionic-framework icon indicating copy to clipboard operation
ionic-framework copied to clipboard

bug: ion-option-button should freeze list scrolling when 'swiping'

Open mikeacook opened this issue 11 years ago • 4 comments

Type: bug

Platform: mobile webview

I was looking for a solution for this today, and also happened upon another person with the same problem in the forums: http://forum.ionicframework.com/t/prevent-scrolling-while-swiping-on-ion-item/14708

mikeacook avatar Jan 16 '15 18:01 mikeacook

Having this problem too.

I managed to work around it by using overflow-scroll="true" on the content tag, as well as adding in a second condition in the _startDrag method (ionic.bundle.js:6878):

// Or check if this is a swipe to the side drag
else if ((!this._didDragUpOrDown && (e.gesture.direction == 'left' || e.gesture.direction == 'right') && Math.abs(e.gesture.deltaX) > 1) || (this._didDragUpOrDown && Math.abs(e.gesture.deltaY) < 4 && Math.abs(e.gesture.deltaX) > 2)) {

Before, the items would not respond, and it was hard to figure out why. Turns out it was _didDragUpOrDown being true, although the intended action was not to scroll. Adding a second check with a vertical cutoff allows just enough leeway for vertical thumb wobbling, without compromising the scrolling behavior.

In fact, it might be possible to simplify the check to include only the horizontal and vertical displacement, like so:

else if (Math.abs(e.gesture.deltaY) < 4 && Math.abs(e.gesture.deltaX) > 2) {

Seems to work without any adverse effects.

huttj avatar Feb 02 '15 20:02 huttj

Any news on if this bug will be fixed in the 1.0 release?

nowcodingaway avatar Feb 12 '15 12:02 nowcodingaway

I am facing similar issue in ionic2. Can you please help me with this.

SnehaShreshtha avatar Jun 09 '17 06:06 SnehaShreshtha

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

ionitron-bot[bot] avatar Sep 02 '18 17:09 ionitron-bot[bot]