Skip to content

Platform.isMobile check #17833

Closed
Closed

Description

@karaggeorge

Bug Report

Ionic version:

[x] 4.x

Current behavior:

  • Visit an ionic site on a Microsoft laptop that supports touch (not a 2-in-1, just a regular laptop with touch screen)
  • Log platform.is('mobile')
  • Returns true
  • Log platform.is('desktop')
  • return false

Expected behavior:

  • platform.is('desktop') should be true, since this is a laptop

Related code:

The error is here: https://github.com/ionic-team/ionic/blob/master/core/src/utils/platform.ts#L69

The check says that a device is mobile if it has any coarse input methods. If you have a mouse/trackpad (which is a fine input method) and also have a coarse input (like touch), it should return false.

I think that check should be !matchMedia(win, '(any-pointer:fine)');

Happy to open a PR if you agree with the above logic.

Activity

  1. liamdebeasi commented on Mar 20, 2019

    @liamdebeasi
    Contributor

    Hi there,

    Thanks for opening an issue with us. This is a known issue, and will potentially require breaking changes. As a result, a feature request has been created here: #17631.

    I will make note of your issue in the thread.

    Thanks for using Ionic!

  2. karaggeorge commented on Mar 20, 2019

    @karaggeorge
    Author

    Ah, I searched with keywords mobile and didn't get that issue. It was too generic. Everything seems to be well summed up there. Thanks for the quick response!

    Still willing to contribute if needed once there's a decision made

  3. ionitron-bot commented on Apr 19, 2019

    @ionitron-bot

    Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

  4. locked and limited conversation to collaborators on Apr 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions