ionic-team / ionic-team/ionic-framework
bug: isMobile returns true for touch screen laptops
- Lenguaje dominante
- TypeScript
- Estrellas
- 52.7k
- Forks
- 13.3k
- Merge medio
- 1 d 15 h
- PR fusionados (30 d)
- 51
Descripción
### 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_
Guía de contribución
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- angular, typescript
- Área
- frontend, mobile-dev
- Tipo de issue
- Error
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Estado de actividad
- Estancado
- Claridad
- Bien especificado
- Aptitud para principiantes
- 45/100