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

Use click to not interfere with scroll #35

Merged
merged 1 commit into from
Jul 30, 2020
Merged

Use click to not interfere with scroll #35

merged 1 commit into from
Jul 30, 2020

Conversation

stephanebisson
Copy link
Collaborator

https://phabricator.wikimedia.org/T258263

On mobile, the touchstart, touchmove and touchend events fire for every touch interactions (tap or scroll).

The click event represent a single tap and does not fire during a scroll gesture.

@stephanebisson stephanebisson requested review from hueitan and medied July 29, 2020 20:28
Copy link
Member

@hueitan hueitan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when clicking on the link, it has a gray background on the link for a blink (too fast I can't capture the screen), that's pseudo-class.

I think you know what I'm saying.

@hueitan
Copy link
Member

hueitan commented Jul 29, 2020

Note :

If we are going to implement this, https://phabricator.wikimedia.org/T257574, touch-enabled desktop (handling both mouse and touch event), we will need to change this click event back to touchend then handle it in the right way (ex : cancel the event order when detect touchmove)

So we either do it the right solution here or focus only on the mobile experience with click for now.

@stephanebisson
Copy link
Collaborator Author

when clicking on the link, it has a gray background on the link for a blink (too fast I can't capture the screen), that's pseudo-class.

I think you know what I'm saying.

This type of feedback is generally considered useful to indicate that the element was activated but in this case I don't know. I'll ask Sudhanshu.

@stephanebisson
Copy link
Collaborator Author

Note :

If we are going to implement this, https://phabricator.wikimedia.org/T257574, touch-enabled desktop (handling both mouse and touch event), we will need to change this click event back to touchend then handle it in the right way (ex : cancel the event order when detect touchmove)

So we either do it the right solution here or focus only on the mobile experience with click for now.

I'm not sure I agree with your assessment here for two reasons:

  1. I think click is the right way to handle tap on mobile. It has built-in tolerance for non-significant touchmove events. There's almost always some touchmove events. Touch start, move, end, are lower-level events meant to implement gestures.

  2. If we do T257574, I think the behavior is going to be fine. Click would try to open the popup on desktop but that would always be a no-op since a mouseenter will happen before the element can be clicked.

In which case specifically do you see it not working correctly?

@hueitan
Copy link
Member

hueitan commented Jul 30, 2020

  1. I think click is the right way to handle tap on mobile. It has built-in tolerance for non-significant touchmove events. There's almost always some touchmove events. Touch start, move, end, are lower-level events meant to implement gestures.

It's true, I can see the benefit now also for triggering popup in the pinch-zooming behaviour. In addition, it has 300ms delay between tap and click, https://developers.google.com/web/updates/2013/12/300ms-tap-delay-gone-away, but it's no longer the common case according to this, so we don't need to worry that.

  1. If we do T257574, I think the behavior is going to be fine. Click would try to open the popup on desktop but that would always be a no-op since a mouseenter will happen before the element can be clicked.

That makes sense. If we do it, then adding more logic between click and mouseenter that shouldn't be difficult.

@hueitan
Copy link
Member

hueitan commented Jul 30, 2020

when clicking on the link, it has a gray background on the link for a blink (too fast I can't capture the screen), that's pseudo-class.
I think you know what I'm saying.

This type of feedback is generally considered useful to indicate that the element was activated but in this case I don't know. I'll ask Sudhanshu.

yeah, this feedback isn't bad actually, similar to the close button of the popup.

@stephanebisson stephanebisson merged commit ea92e26 into master Jul 30, 2020
@stephanebisson stephanebisson deleted the T258263 branch July 30, 2020 12:20
@stephanebisson stephanebisson restored the T258263 branch May 13, 2021 17:27
@stephanebisson stephanebisson deleted the T258263 branch May 13, 2021 17:32
@stephanebisson stephanebisson restored the T258263 branch July 28, 2022 12:56
@stephanebisson stephanebisson deleted the T258263 branch July 28, 2022 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants