MetaMask / MetaMask/metamask-sdk

[Bug]: iPad detecting as desktop

Open
#892 0 comments 0 reactions 0 assignees View on GitHub
Bug Triage
Dominant language
TypeScript
Stars
338
Forks
260
PR merge metrics
No merged PRs in 30d

Description

### SDK

Web

### Provide environment information

- iPad OS

From a quick look it seems that in `PlatfformManager.ts` the isMobile helper looks like:
```javascript
isMobile() {
const browser = Bowser.parse(window.navigator.userAgent);

return (
browser?.platform?.type === 'mobile' ||
browser?.platform?.type === 'tablet'
);
}
```
When checking this directly in the developer console for Safari, the userAgent comes up `"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.0 Safari/605.1.15"` which may lead to Bowser to think it's a desktop browser instead of a mobile browser.
![Screenshot 2024-06-19 at 10 26 46](https://github.com/MetaMask/metamask-sdk/assets/104831203/aca9be6d-1c3b-4f6c-b0f2-2a9d3dca9b79)

### MetaMask SDK Version

0.20.5

### MetaMask Mobile app Version

All

### What browser are you using? (if relevant)

Safari

### How are you deploying your application? (if relevant)

_No response_

### Describe the Bug

iPad Safari is currently being detected as a desktop instead of a mobile device and thus presents the QR code for scanning instead of deeplinking to MetaMask. The mobile wallet is not adapted to work on mobile devices even though it works similar to an iPhone.

### Expected Behavior

Trying to connect will deeplink to MetaMask

### Link to reproduction - Issues with a link to complete (but minimal) reproduction code will be addressed faster

_No response_

### To Reproduce

- Open a dapp in Safari on an iPad
- Tapp Connect
- See issue

Contributor guide

Open the contributing guide

Research direction

Start in PlatfformManager.ts by tracing the isMobile helper and how Bowser parses Safari on iPadOS. Reproduce the issue in iPad Safari or with the reported user agent, then verify that connecting deeplinks to MetaMask instead of showing a QR code.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend, mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.