Commit 4cf2bee
Honor "Request Desktop Site" on mobile browsers (#14222)
## Summary
Today, when a user on a mobile browser toggles "Request Desktop Site",
the User-Agent flips to a desktop one — but the web client still serves
the mobile experience. The cause is a fallback in `isMobile()` (and the
duplicate `isMobileWeb()`) that flags any device with
`navigator.platform === 'MacIntel'` and `maxTouchPoints > 1` as mobile,
overriding the UA. iPadOS 13+ Safari sends a Mac UA by default, so iPads
always tripped this branch regardless of what the browser claimed to be.
This PR removes that override. The User-Agent regex on its own already
returns `false` once a mobile browser advertises a desktop UA, so we now
serve the desktop app whenever the browser asks for it.
- `packages/web/src/utils/clientUtil.ts`: drop the `MacIntel` +
touchPoints branch in `isMobile()`; rely on `isMobileUserAgent()` only.
- `packages/web/src/common/utils/isMobileWeb.ts`: drop the same branch
in the duplicate web copy.
The dev-only `localStorage.__FORCE_MOBILE__` override is preserved.
## Test plan
- [ ] On an iPhone, Safari with default settings → mobile site (UA
contains "iPhone").
- [ ] On an iPhone, Safari → "Request Desktop Website" → desktop site is
served.
- [ ] On an iPad (iPadOS 13+) with default Safari settings → desktop
site (matches the browser's stated UA).
- [ ] On an iPad with "Request Mobile Website" toggled → mobile site (UA
flips to iPad).
- [ ] On Android Chrome, default → mobile site.
- [ ] On Android Chrome, "Desktop site" toggled → desktop site.
- [ ] On a regular desktop browser → desktop site (no regression).
- [ ] Dev-only `localStorage.__FORCE_MOBILE__ = '1'` still forces mobile
mode in a desktop browser.
https://claude.ai/code/session_01AJfWVtxfhkeoypc9x1Lvez
---
_Generated by [Claude
Code](https://claude.ai/code/session_01AJfWVtxfhkeoypc9x1Lvez)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 62b9653 commit 4cf2bee
3 files changed
Lines changed: 16 additions & 16 deletions
File tree
- .changeset
- packages/web/src
- common/utils
- utils
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
6 | 9 | | |
7 | 10 | | |
8 | 11 | | |
| |||
17 | 20 | | |
18 | 21 | | |
19 | 22 | | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
48 | | - | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
49 | 53 | | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
| 54 | + | |
| 55 | + | |
61 | 56 | | |
62 | 57 | | |
63 | 58 | | |
| |||
0 commit comments