ionic-team / ionic-team/ionic-framework
bug: isMobile returns true for touch screen laptops
- 主要语言
- TypeScript
- 星标
- 52.7k
- 派生
- 13.3k
- 平均合并
- 1 天 14 小时
- 30 天内合并 PR
- 50
描述
### Prerequisites
- [X] I have read the [Contributing Guidelines](https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#creating-an-issue).
- [X] I agree to follow the [Code of Conduct](https://ionicframework.com/code-of-conduct).
- [X] I have searched for [existing issues](https://github.com/ionic-team/ionic-framework/issues) that already report this problem, without success.
### Ionic Framework Version
- [ ] v4.x
- [X] v5.x
- [X] v6.x
### Current Behavior
Platform#isMobile function is querying for `(any-pointer: coarse)`, which means it will return true when at least one input device uses a touch mechanism. An app running on my laptop Platform#isMobile is returning true because it has an input device that uses a touch mechanism.
### Expected Behavior
Platform#isMobile function should be querying for `(pointer: coarse)`, which means it will return true only when the primary input device uses a touch mechanism. An app running on my laptop Platform#isMobile is returning false because it has not an input device that uses a touch mechanism as its primary input device.
### Steps to Reproduce
- Get a laptop that has a touch screen.
- Start a new ionic app with a blank template
- use the platform service and note that platform#platforms return `["mobile", "mobileweb"]`
### Code Reproduction URL
https://github.com/NormanV41/ionic-issues-demo
### Ionic Info
[WARN] Error loading @capacitor/ios package.json: Error: Cannot find module
'@capacitor/ios/package'
Require stack:
- /usr/lib/node_modules/@ionic/cli/lib/project/index.js
- /usr/lib/node_modules/@ionic/cli/lib/index.js
- /usr/lib/node_modules/@ionic/cli/index.js
- /usr/lib/node_modules/@ionic/cli/bin/ionic
[WARN] Error loading @capacitor/android package.json: Error: Cannot find module
'@capacitor/android/package'
Require stack:
- /usr/lib/node_modules/@ionic/cli/lib/project/index.js
- /usr/lib/node_modules/@ionic/cli/lib/index.js
- /usr/lib/node_modules/@ionic/cli/index.js
- /usr/lib/node_modules/@ionic/cli/bin/ionic
Ionic:
Ionic CLI : 6.18.0 (/usr/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 6.0.0-rc.2
@angular-devkit/build-angular : 12.1.4
@angular-devkit/schematics : 12.1.4
@angular/cli : 12.1.4
@ionic/angular-toolkit : 4.0.0
Capacitor:
Capacitor CLI : 3.2.5
@capacitor/android : not installed
@capacitor/core : 3.2.5
@capacitor/ios : not installed
Utility:
cordova-res : 0.15.3
native-run : 1.5.0
System:
NodeJS : v14.16.1 (/usr/bin/node)
npm : 6.14.12
OS : Linux 5.14
### Additional Information
_No response_
贡献指南
调研方向
从 Platform#isMobile 实现以及链接的复现应用所使用的平台服务开始。在触摸屏笔记本电脑上复现该行为,然后验证平台查询能区分主指针与任何可用指针。完成的标准是,platform#platforms 不再为该笔记本电脑报告 mobile 和 mobileweb,同时保留对触摸为主指针的设备的预期检测。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- angular, typescript
- 领域
- frontend, mobile-dev
- Issue 类型
- 缺陷
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 活跃度
- 停滞
- 描述清晰度
- 描述清楚
- 新手友好度
- 45/100