ionic-team / ionic-team/ionic-framework

bug: isMobile returns true for touch screen laptops

Ouverte
#24,179 6 commentaires 1 réaction 0 personnes assignées Voir sur GitHub
bug: external type: bug
Langage dominant
TypeScript
Étoiles
52.7k
Forks
13.3k
Merge moyen
1 j 15 h
PR mergées (30 j)
51

Description

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

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.