ionic-team / ionic-team/ionic-framework

bug: isMobile returns true for touch screen laptops

Đang mở
#24,179 6 bình luận 1 reaction 0 người được giao Xem trên GitHub
bug: external type: bug
Ngôn ngữ chính
TypeScript
Star
52.7k
Fork
13.3k
Merge trung bình
1 ngày 15 giờ
Pull request đã merge (30 ngày)
51

Mô tả

### 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_

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Start with the Platform#isMobile implementation and the platform service used by the linked reproduction app. Reproduce the behavior on a touch-screen laptop, then verify the platform query distinguishes the primary pointer from any available pointer. Done means platform#platforms no longer reports mobile and mobileweb for that laptop while retaining expected detection for touch-primary devices.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
angular, typescript
Lĩnh vực
frontend, mobile-dev
Loại issue
Lỗi
Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
45/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.