Page MenuHomePhabricator

Wikipedia Preview treats touchscreen computers as mobile devices
Closed, ResolvedPublicBUG REPORT

Assigned To
Authored By
hueitan
Jul 9 2020, 1:20 PM
Referenced Files
F56796036: 2024-07-30_14-45-50.mp4.gif
Tue, Jul 30, 9:49 PM
F56796035: 2024-07-30_14-44-48.mp4.gif
Tue, Jul 30, 9:49 PM
F56796031: 2024-07-30_14-39-46.mp4.gif
Tue, Jul 30, 9:49 PM
F56796030: 2024-07-30_14-38-21.mp4.gif
Tue, Jul 30, 9:49 PM
F56796029: 2024-07-30_14-36-23.mp4.gif
Tue, Jul 30, 9:49 PM
F56796021: 2024-07-30_14-33-18.mp4.gif
Tue, Jul 30, 9:49 PM
F56791151: 2024-07-30_10-13-30.mp4.gif
Tue, Jul 30, 5:39 PM
F56791145: 2024-07-30_10-11-23.mp4.gif
Tue, Jul 30, 5:39 PM

Description

If a device supports touch events, Wikipedia Preview assumes that it's a touch-only, smaller-screen mobile device.

However, laptops with touchscreens support touch events, so Wikipedia Preview treats them as mobile devices. This has three problems:

  • Previews don't show when the user hovers a cursor on the link
  • Clicking leads you to the mobile site, not the main site.
  • Previews are too wide. Here's an example based on a 1200x800 screen:

Screen Shot 2023-03-22 at 18.40.44.png (1×2 px, 658 KB)

On a random day (2023-03-15), such touchscreen computers accounted for 25% of touch-device previews and 3% of all previews (source). And these computers probably account for a greater fraction of devices seeing Wikipedia Preview links, because previewing is much easier and more discoverable when you can do it just by hovering.

Useful references:

QA Results - Demo

ACStatusDetails
1T257574#10028973

Event Timeline

Huei (myself) has one touchable desktop browser (chrome) device.

Huei comment in the internal discussion channel

Thinking out loud here regarding the touchable device

In our current mindset when dealing with desktop or mobile browser, we use touchable event to do popup (desktop) and touchPopup (mobile), and we are not yet include tablet browser.

In today's world, it's hardly to tell the difference between desktop / tablet, any modern desktop can turn to tablet mode when unplug the keyboard from screen. Tablet and also turn to desktop when plug with keyboard + mouse.

When i look at our code, there are two events mouse and touch which use to detect the difference, there are mostly independence, that means in desktop touch event doesn't work, in mobile mouse shouldn't work because there isn't mouse for table/mobile.

Given that there is possible the browser (at least mine is) supports both mouse and touch, when I use mouse I would like to see the popup, when I use hand to touch I would like to see the popup in mobile mode, if that makes sense.

Therefore, I think it's possible for us not to detect isTouch, we can find the difference when receiving which event is being called, that said mouse belongs to desktop, touch belongs to mobile and tablet.

I think this way we solve most of the device and we don't have to worry about which mode user in, instead taking care which event it has.

I hope the explanation here is easy to read, let me know what's your thought and let's have the discussion when needed.

It's also recommend by Modernizr

It's recommended to bind both mouse and touch/pointer events simultaneously, https://modernizr.com/docs/#touch

SBisson changed the subtype of this task from "Bug Report" to "Task".Jul 30 2020, 12:57 AM
Aklapper changed the subtype of this task from "Task" to "Bug Report".Dec 2 2022, 11:19 AM
nshahquinn-wmf renamed this task from Touchable desktop browser to Wikipedia Preview treats touchscreen computers as mobile devices.Mar 23 2023, 2:16 AM
nshahquinn-wmf updated the task description. (Show Details)

I updated the description to make it clearer, add an image, and add stats about how many of these devices we see using Wikipedia Preview.

Currently, the device classification in our instrumentation is based on the presence of touch support (if the device does not have touch support, we add the standard wprov=wppw2 to its preview and pageview URLs; otherwise, we add a t to the end).

When we fix this, it will be very helpful if we can update the classification to something closer to the normal concept of mobile (smartphone, tablet) or computer (desktop, laptop). We can signal this by changing the last letter of the wprov parameter to m for mobiles or c for computers. We should update the instrumentation version at the same time (that is, changing wppw2 to wppw3).

(Note for my future self: once that is done, I intend to update the ETL job to populate the device_type column with "mobile" or "computer" when we get the new letters. Those values will coexist with the older "touch" and "non-touch" values, and I can combine them as necessary in the reporting and analysis step.)

SBisson raised the priority of this task from Low to Needs Triage.May 15 2024, 12:59 PM
SBisson edited projects, added Inuka-Team (Kanban); removed Inuka-Team.
SBisson subscribed.
SBisson triaged this task as Medium priority.
SBisson moved this task from Definition to Dev on the Inuka-Team (Kanban) board.
Combinations
viewporttouchpointerpopupeventsNotes
smallfalsefalse--invalid
smallfalsetrue--KaiOS device (unsupported)
smalltruefalsemobiletouchExisting mobile mode
smalltruetruemobiletouch, pointerenterSmall tablet (iPad mini) with connected mouse
bigfalsefalse--Computer with only a keyboard (unsupported)
bigfalsetruedesktoppointerenterExisting desktop mode
bigtruefalsedesktoptouchLarge tablet (iPad pro)
bigtruetruedesktoptouch, pointerenterMain case this task is about
Legend
  • viewport: The size of the device viewport. Values are small or big with small being < 768px
  • touch: the device has touch capabilities
  • pointer: the device has pointer capabilities (mouse or trackpad)
  • popup: mode of the resulting popup. Values are "mobile" or "desktop". Mobile is a bottom drawer and desktop is smaller and floating next to the target
  • events: events that trigger the popup to open
Conclusions
  1. Only the size of the viewport determines the size of the popup. small = mobile, big = desktop
  2. If the device has touch capabilities, touch opens the popup. If it has a pointing device, pointerenter open the popup. If it has both, they should both work.
PWaigi-WMF changed the task status from Open to In Progress.Mon, Jul 15, 7:38 AM

@hueitan @SBisson I can only test via BrowserStack with the Demo pages mentioned. As for the touchscreen treating it as mobile, it is fine as seen in the gifs. I am having an issues with iPad 10th as seen in the gif below. Can you please review before moving to Done?

UPDATE: Verified that dark mode is fine since the functionality works in light mode

Test Result - Demo

Status: ✅ PASS
Environment: Demo
OS: Windows 11 via BrowserStack
Browser: Chrome 127, Firefox 128
Device: MBA
Emulated Device: BrowserStack

Test Artifact(s):
However, laptops with touchscreens support touch events, so Wikipedia Preview treats them as mobile devices. This has three problems:

Previews don't show when the user hovers a cursor on the link
Clicking leads you to the mobile site, not the main site.
Previews are too wide. Here's an example based on a 1200x800 screen:

https://wikimedia.github.io/wikipedia-preview/main/articles/spanish.html
https://wikimedia.github.io/wikipedia-preview/main/articles/english.html

Chrome- LightChrome- DarkFireFox- LightFirefox- Dark
2024-07-30_08-21-52.mp4.gif (934×1 px, 1 MB)
2024-07-30_10-19-59.mp4.gif (1×1 px, 2 MB)
2024-07-30_10-11-23.mp4.gif (1×1 px, 2 MB)
2024-07-30_10-13-30.mp4.gif (1×1 px, 2 MB)
iPhone 15 Pro Max- LightiPhone 15 Pro Max- DarkiPad 10th-LightiPad 10th- DarkGalaxy S23- PortraitGalaxy S23- Landscape
2024-07-30_14-33-18.mp4.gif (788×572 px, 698 KB)
2024-07-30_14-36-23.mp4.gif (794×456 px, 1 MB)
2024-07-30_14-38-21.mp4.gif (816×680 px, 963 KB)
2024-07-30_14-39-46.mp4.gif (790×594 px, 1 MB)
2024-07-30_14-44-48.mp4.gif (816×710 px, 2 MB)
2024-07-30_14-45-50.mp4.gif (668×932 px, 570 KB)