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

Fix mouse functionality on touch devices. #1960

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

danrha
Copy link

@danrha danrha commented Dec 27, 2021

Description

Remove special case for touch devices when adding event listeners to the view.

Related issues

@eeropic
Copy link
Member

eeropic commented Mar 25, 2022

Hmm, looking at how it's implemented at the moment

if (navigator.pointerEnabled || navigator.msPointerEnabled) {

It is checking
if (navigator.pointerEnabled || navigator.msPointerEnabled) {

But it should be checking if ('PointerEvent' in window) { instead.

Could you try this instead of the changes you are proposing, and check if it solves it,
if so - then it would be good to go from my point of view. I tried this when I had issues with Apple Pencil and touch simultaneously.

@@ -1076,18 +1076,9 @@ new function() { // Injection scope for event handling on the browser
mousemove = 'pointermove MSPointerMove';
mouseup = 'pointerup pointercancel MSPointerUp MSPointerCancel';
} else {
Copy link
Member

@eeropic eeropic Mar 25, 2022

Choose a reason for hiding this comment

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

You should try changing line 1073

if (navigator.pointerEnabled || navigator.msPointerEnabled) {
to if ('PointerEvent' in window) { and check whether it solves your problem

(instead of the changes proposed below)

Copy link
Member

Choose a reason for hiding this comment

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

Unfortunately there seems to be some possible breaking behaviour, which I'm not fully aware of atm #1810 (comment)

Copy link
Author

Choose a reason for hiding this comment

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

Using PointerEvent does fix it for me but I still see no harm in always listening to all the events instead of depending on the userAgent string. The mouse events shouldn't be called after calling preventDefault on the touch events anyways.

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

Successfully merging this pull request may close these issues.

Clicks not detected when connecting a mouse to iPad
2 participants