Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect isMobile detection in src/lib/util.js #1477

Closed
adamsarek opened this issue Nov 6, 2024 · 0 comments
Closed

Incorrect isMobile detection in src/lib/util.js #1477

adamsarek opened this issue Nov 6, 2024 · 0 comments
Labels
Milestone

Comments

@adamsarek
Copy link

Describe the bug
I found out a bug that when I press [ENTER], my editor loses focus to _focusTemp. I figured out it's caused by isMobile being true (defined in utils.js). Root of the problem is navigator.maxTouchPoints which is unreliable in Chrome due to some fluctuations. In my case it was equal to 10, even though I have no touch input and I'm on desktop. Based on this I think it should not be used as is in isMobile property check. I propose a slight change:

this.isMobile = (
    /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ||
    (
        (navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0) &&
        'ontouchstart' in window
    )
);

To Reproduce
Steps to reproduce the behavior:

  1. Press [ENTER]
  2. Focus is on input (_focusTemp)

Expected behavior
isMobile is false on desktop chrome.

Desktop

  • OS: Windows 11
  • Browser: Google Chrome
  • Version: 130.0.6723.92

Release

  • Version: v2.47.0
@JiHong88 JiHong88 added the bug label Nov 13, 2024
@JiHong88 JiHong88 added this to the 2.47.1 milestone Nov 13, 2024
JiHong88 added a commit that referenced this issue Jan 8, 2025
@JiHong88 JiHong88 closed this as completed Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants