Skip to content

fix: improve isMobile() to exclude touchscreen desktops/laptops#5649

Open
farbodghasemlu wants to merge 1 commit into
reown-com:mainfrom
farbodghasemlu:fix/mobile-detection-touchscreen-desktops
Open

fix: improve isMobile() to exclude touchscreen desktops/laptops#5649
farbodghasemlu wants to merge 1 commit into
reown-com:mainfrom
farbodghasemlu:fix/mobile-detection-touchscreen-desktops

Conversation

@farbodghasemlu
Copy link
Copy Markdown

@farbodghasemlu farbodghasemlu commented Apr 21, 2026

fix: improve isMobile() detection to exclude touchscreen desktops/laptops

Fixes #5648

Problem

CoreHelperUtil.isMobile() uses (pointer:coarse) as a mobile detection signal. This misclassifies touchscreen desktops and laptops (Surface Pro, Dell XPS 2-in-1, Lenovo Yoga, etc.) as mobile devices.

The downstream impact: ConnectorUtil.getConnectViewItems() completely excludes the WalletConnect QR connector when isMobile returns true, so users on touchscreen laptops cannot connect via QR code scan.

Solution

Check whether a fine pointer is also available using (any-pointer:fine). On a touchscreen laptop, (pointer:coarse) is true (touchscreen is primary) but (any-pointer:fine) is also true (trackpad/mouse exists). On actual mobile devices, only (pointer:coarse) matches.

This approach is recommended by Patrick H. Lauke, co-editor of the W3C Pointer Events spec:

@media (pointer: coarse) and (any-pointer: fine) suggests the primary input is touchscreen, but that there is a mouse or stylus present.
Interaction Media Features and Their Potential (for Incorrect Assumptions)

Changes

  • CoreHelperUtil.isMobile(): UA regex check first (definitive), then media query check with any-pointer:fine exclusion for multi-input devices
  • Tests: Added test cases for mobile phone, non-touch desktop, and touchscreen laptop scenarios

Detection matrix

Device pointer:coarse any-pointer:fine UA match isMobile()
iPhone / Android phone true
iPad true
Desktop (no touch) false
Surface / touch laptop false ✅ (fixed)
Phone + bluetooth mouse true ✅ (UA takes priority)

Testing

  • Verified on Windows 11 touchscreen laptop (Chrome, Edge, Firefox)
  • Verified on Ubuntu 24 desktop (no regression)
  • Verified on Android / iOS (no regression)
  • Unit tests pass: pnpm test

References

CoreHelperUtil.isMobile() used (pointer:coarse) as a mobile signal,
which misclassifies touchscreen desktops/laptops as mobile. This caused
WalletConnect QR to be hidden on devices like Surface Pro, Dell XPS 2-in-1,
Lenovo Yoga, etc.

Now checks (any-pointer:fine) to detect multi-input devices: if a fine
pointer (trackpad/mouse) coexists with the coarse pointer (touchscreen),
the device is not mobile.

Approach based on W3C Pointer Events spec co-editor Patrick H. Lauke's
guidance on interaction media features:
https://css-tricks.com/interaction-media-features-and-their-potential-for-incorrect-assumptions/
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 21, 2026

🦋 Changeset detected

Latest commit: bd1882a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 26 packages
Name Type
@reown/appkit-controllers Patch
@reown/appkit-adapter-bitcoin Patch
@reown/appkit-adapter-ethers Patch
@reown/appkit-adapter-ethers5 Patch
@reown/appkit-adapter-solana Patch
@reown/appkit-adapter-ton Patch
@reown/appkit-adapter-tron Patch
@reown/appkit-adapter-wagmi Patch
@reown/appkit Patch
@reown/appkit-ui Patch
@reown/appkit-core Patch
@reown/appkit-utils Patch
@reown/appkit-scaffold-ui Patch
@reown/appkit-siwe Patch
@reown/appkit-siwx Patch
@reown/appkit-wallet-button Patch
@reown/appkit-experimental Patch
@reown/appkit-pay Patch
@reown/appkit-cdn Patch
@reown/appkit-universal-connector Patch
@reown/appkit-testing Patch
@reown/appkit-common Patch
@reown/appkit-polyfills Patch
@reown/appkit-wallet Patch
@reown/appkit-cli Patch
@reown/appkit-codemod Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 21, 2026

@farbodghasemlu is attempting to deploy a commit to the Reown Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 21, 2026

All contributors have signed the CTA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@farbodghasemlu
Copy link
Copy Markdown
Author

I have read the CTA Document and I hereby sign the CTA

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.

[bug] CoreHelperUtil.isMobile() misclassifies touchscreen desktops — WalletConnect QR hidden

1 participant