Closed Bug 1500672 Opened 6 years ago Closed 5 years ago

Responsive Design Mode with touch simulation: navigator.maxTouchPoints still zero

Categories

(DevTools :: Responsive Design Mode, defect, P3)

63 Branch
defect

Tracking

(firefox77 fixed)

RESOLVED FIXED
Firefox 77
Tracking Status
firefox77 --- fixed

People

(Reporter: redux, Assigned: mtigley)

References

(Blocks 1 open bug)

Details

(Whiteboard: [rdm-reserve])

Attachments

(4 files)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36 Steps to reproduce: On a non-touch device: - Enable Responsive Design Mode - turn on touch simulation - go to https://patrickhlauke.github.io/touch/tests/pointer-multitouch-detect.html - test navigator.maxTouchPoints (from the pointer events specification) Actual results: navigator.maxTouchPoints is 0 Expected results: navigator.maxTouchPoints should at least report 1 (as it's emulating touch)
For comparison: Chrome DevTools, when emulating mobile devices with the device toolbar, fakes a navigator.maxTouchPoints value of 1
Component: Untriaged → Responsive Design Mode
Product: Firefox → DevTools
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P3
I'll try to find a fix.
Assignee: nobody → bwerth

+1 Please fix asap!
navigator.maxTouchPoints returns 0 on a valid Touchscreen device causing tests for Touchscreen to fail, see:-
https://github.com/patrickhlauke/touch/issues/19

Assignee: bwerth → nobody
Priority: P3 → P2
Whiteboard: [rdm-mvp]
Priority: P2 → P3
Whiteboard: [rdm-mvp] → [rdm-reserve]
Assignee: nobody → mtigley
Status: NEW → ASSIGNED

(In reply to Patrick H. Lauke from comment #1)

For comparison: Chrome DevTools, when emulating mobile devices with the
device toolbar, fakes a navigator.maxTouchPoints value of 1

Unless we have a way of knowing what the simulated device's navigator.maxTouchPoints value is, we might need to have a fake value of 1 as well.

The only use case I can see for navigator.maxTouchPoints is if the user wants to detect a touch screen. So it would be sufficient to always return a value of 1 while simulating a touch device. Of course, this would be untrue for many modern devices so another option is to add a "maxTouchPoints" property to the phone device object. Though this would mean modifying Mozilla's CDN for simulated devices to have the actual values (which could be more work than it's worth).

Martin, do you think we can do what Chrome DevTools is doing and fake the navigator.maxTouchPoints value to be 1 for all simulated devices until we have a better way of getting the actual device's max touchpoints value?

Flags: needinfo?(mbalfanz)

Let's go with faking a value of 1 for every device that is marked as touch device in our dataset.

I researched the sources we usually utilize to get device specs and non of them includes information about maxTouchPoints. So I guess that we have to live with a less accurate approach. The main use case will still work, and maybe we can improve this in the future.

Flags: needinfo?(mbalfanz)

while theoretically maxTouchPoints could be also be used to check for the (very rare, probably) situation where a device supports only one touch point, but is not multi-touch/two-finger-swipe capable, faking a value of 1 does indeed sound like a reasonable approximation (and yes it's still what Chrome fakes too).

Pushed by mtigley@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/d077dd49d224 Part 1: Add MaxTouchPointsOverride to BrowsingContext. r=bradwerth,smaug https://hg.mozilla.org/integration/autoland/rev/8b53b0098b6b Part 2: Make Navigator return MaxTouchPointsOverride when in RDM. r=bradwerth,smaug https://hg.mozilla.org/integration/autoland/rev/8ed14f008aa6 Part 3: Have RDM override maxTouchPoints when touch simulation is enabled. r=bradwerth
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 77
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: