fix: improve isMobile() to exclude touchscreen desktops/laptops#5649
Open
farbodghasemlu wants to merge 1 commit into
Open
fix: improve isMobile() to exclude touchscreen desktops/laptops#5649farbodghasemlu wants to merge 1 commit into
farbodghasemlu wants to merge 1 commit into
Conversation
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 detectedLatest commit: bd1882a The changes in this PR will be included in the next version bump. This PR includes changesets to release 26 packages
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 |
|
@farbodghasemlu is attempting to deploy a commit to the Reown Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
|
All contributors have signed the CTA ✍️ ✅ |
Author
|
I have read the CTA Document and I hereby sign the CTA |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix: improve
isMobile()detection to exclude touchscreen desktops/laptopsFixes #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 whenisMobilereturnstrue, 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)istrue(touchscreen is primary) but(any-pointer:fine)is alsotrue(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:
Changes
CoreHelperUtil.isMobile(): UA regex check first (definitive), then media query check withany-pointer:fineexclusion for multi-input devicesDetection matrix
pointer:coarseany-pointer:fineisMobile()true✅true✅false✅false✅ (fixed)true✅ (UA takes priority)Testing
pnpm testReferences