Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Switch] The dragEnd() function needs to make sure the switch is in an allowed position #54

Open
tomayac opened this issue Aug 12, 2021 · 6 comments

Comments

@tomayac
Copy link

tomayac commented Aug 12, 2021

The dragEnd() function, triggered by pointerup, needs to make sure the switch is in an allowed position. Currently it is possible to drag the switch, then without releasing the finger drag outside of the switch so that the switch is in an "in-between" visual state, and then release the finger.

const dragEnd = event => {

image

@argyleink
Copy link
Owner

when i release, it doesnt stick, it slides to either side. which browser are you on?

Kapture 2021-08-16 at 07 35 33

i have a window.onpointerup event, which is when the thumb position is evaluated to decide on/off. curious which scenarios you're in that arent firing that event.

@tomayac
Copy link
Author

tomayac commented Aug 16, 2021

Try it on an actual device. The movement you make is exactly correct and repros the behavior.

@argyleink
Copy link
Owner

which device you on? works great on my devices and emulators.

screen-20210816-082445.mp4

@tomayac
Copy link
Author

tomayac commented Aug 16, 2021

This is on iOS 15 (with the funny Safari bottom URL bar, which might be interfering when it comes to scroll and drag handling?) on an iPhone 11 Max Pro.

@argyleink
Copy link
Owner

looks like an iOS bug that if the user begins the drag with vertical movement, the page is scrolled and then the pointerup event (or move events) are never fired. the beginning of the gif shows the desired ux but is also beginning the swipe horizontally. the end of the gif, showing the undesired ux, is when the drag event is competing with page scroll.

Kapture 2021-08-16 at 09 59 12

i think there's a lot of complex stuff happening here with touch-action, page scroll and pointer events and iOS is prioritizing the page scroll over the pointer events? i'm not sure how to fix this other than preventing document scroll when the gesture has begun from inside one of these switches. maybe touch-action can help more here, cuz it's already preventing page horizontal scroll when panning the thumb (ipad was the main offender of horizontal page scroll competing with horizontal drag of the thumb).

have ideas? did i isolate the bug in the above gif?

@tomayac
Copy link
Author

tomayac commented Aug 16, 2021

Yeah, it looks like preventing scrolling could help improve the situation. It’s indeed pretty complex to debug what’s going on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants