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

Firefox user agent detection prevents users to benefit from pressure drawing. #4

Closed
karlcow opened this issue Mar 8, 2022 · 12 comments
Assignees

Comments

@karlcow
Copy link

karlcow commented Mar 8, 2022

On webcompat/web-bugs#99826 (comment)

@dholbert determined there was user agent detection against Firefox which removed the ability for Firefox users to use the pressure for affecting the drawing.

Could you fix it?

@bitbof
Copy link
Owner

bitbof commented Mar 8, 2022

Thanks for reaching out & spotting this! I pushed & released a fix that enables pressure in Firefox. I think I used to have problems with PointerEvents on mobile, but it seems to be working fine when I was testing it just now.

@saschanaz
Copy link

saschanaz commented Mar 8, 2022

Thanks! I still see isFirefox uses, can those be removed too or are there still problems?

Edit: Pressure now works on Surface Pro 7 👍

@bitbof
Copy link
Owner

bitbof commented Mar 8, 2022

Glad that it's working now!

I used to have a few more problems with PointerEvents when testing on Windows 10:

  • movementX/Y are equal to pageX/Y in coalesced events (not 100% on this)
  • when using pen, values of 'button' and 'buttons' are irregular
  • when using pen, pointertype sometimes 'touch'
  • timestamp is 0 in coalesced events

I will check if those are still around. The last time I tested was ~2 years ago. If the bold issues are gone I can remove isFirefox.

@saschanaz
Copy link

saschanaz commented Mar 8, 2022

movementX/Y are equal to pageX/Y in coalesced events (not 100% on this)

I can confirm this: https://bugzilla.mozilla.org/show_bug.cgi?id=1753724. I guess the following is the relevant code here:

export const mouseEventHasMovement = (() => {
// no support: IE, Safari, Safari iOS
// supported but broken: Firefox
if (!('MouseEvent' in window)) {
return false;
}
let mouseEvent;
try {
mouseEvent = new MouseEvent('mousemove'); // browsers not supporting the constructor don't have it
} catch (e) {
return false;
}
if (!('movementX' in mouseEvent)) {
return false; // likely safari
}
return !isFirefox;
})();

I think others are okay now. Please ping if not 👍

@bitbof
Copy link
Owner

bitbof commented Mar 8, 2022

Thanks for confirming. Yes that's the relevant code. Perhaps there is a way to check for that issue that doesn't involve useragent sniffing.

I'll keep an eye on that ticket.

@bitbof
Copy link
Owner

bitbof commented Mar 8, 2022

@saschanaz The second issue "when using pen, values of 'button' and 'buttons' are irregular" is still present. I've created a demonstration page: https://bitbof.com/stuff/2022-03-08-ff-pointer-buttons/
The first pointermove after pointerdown sometimes has the value 0 for buttons.

Screenshot (top are the most recent pointer events):
2022_03_08_screenshot

@saschanaz
Copy link

Interesting, which device are you using? I don't see such inconsistency on Surface Pro 7 (Windows 11) 🤔, I wonder whether this is device specific...

@saschanaz
Copy link

Oh, never mind. I also see it from some of the first pointermove events.

@bitbof
Copy link
Owner

bitbof commented Mar 8, 2022

Yea it doesn't happen every time. I've created a separate issue for removing isFirefox: #5

@bitbof bitbof closed this as completed Mar 8, 2022
@saschanaz
Copy link

https://bugzilla.mozilla.org/show_bug.cgi?id=1758516, btw.

@bitbof
Copy link
Owner

bitbof commented Mar 8, 2022

Thanks! Shouldn't that be "pointermove shouldn't return buttons: 0"?

@saschanaz
Copy link

Oops, sure. Fixed it.

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

3 participants