slider icon indicating copy to clipboard operation
slider copied to clipboard

Touch direction locking

Open DieterHolvoet opened this issue 6 years ago • 7 comments

Fixes issue #308. There's still 3 tests failing and all are related to dragOffset, but I don't really know what's wrong, so it would be nice if someone could have a look.

Biggest changes

Moved a big part of the code in onTouchStart to onFirstTouchMove to be called once within onTouchMove

Reason: It is impossible to determine the direction of the swipe in onTouchStart because there's only one touch point to work with. Because of that, we have to postpone the initialization of the component to the first call of onTouchMove, because at that point we have a second touch point to calculate the swipe direction with. If the swipe is in the wrong direction, the component will never be initialized, and page scroll will work as expected.

Added dragging state with matching class ${prefixCls}-dragging

Reason: because of the touch-action: none and touch-action: pan-x styles, page scrolling is interrupted regardless of what the component does. I added a new css class to set these styles after the component initialized to fix scrolling issues.

DieterHolvoet avatar May 06 '18 10:05 DieterHolvoet

I should also say that the horizontal slider with my changes has been used on a production site for about three months, everything working perfectly: https://www.klj.be/spelen/spelen-maken-of-vinden/spelendatabank

DieterHolvoet avatar May 06 '18 10:05 DieterHolvoet

Your changes work very well for me, without them the slider is basically unusable on a mobile device where the user needs to scroll up and down the page. Could you please have a look at this @yesmeck ?

dislick avatar Jun 07 '18 08:06 dislick

Any updates on this? 😬

luisrudge avatar Aug 23 '18 13:08 luisrudge

@zombieJ I'm interested in fixing this scroll issue as well - if I'm able to fix the unit tests, would this be a candidate for merging?

grahamcracker avatar Sep 28 '18 00:09 grahamcracker

hi @grahamcracker , since I don't familiar with touch devices. I may need others to help check on this PR. But yes, PR is welcomed : )

zombieJ avatar Sep 28 '18 15:09 zombieJ

any updates on this?

0x5e5e avatar Dec 12 '19 19:12 0x5e5e

Rebase please.

yoyo837 avatar Apr 15 '23 15:04 yoyo837