question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

does not work in Firefox on touch+mouse hybrid devices (like a laptop with a touch screen)

See original GitHub issue

The dropdown opens and then immediately closes again. You are not able to select anything.

It happens even on the latest version in the demos on react-select.com

It already was like that in 2.2.0 and maybe before that as well.


Can be reproduced in a regular version of Firefox (no touch devices needed) on react-select.com:

Use the devtools to go into the “responsive” mode (CTRL+SHIFT+M) and activate touch emulation.

The dropdown has to be initialized with touch already activated - so reload the page after activating touch emulation.

Tested in Firefox 66 on Windows 10.


I think the problem is as follows: onControlMouseDown gets called when you touch it. The dropdown opens. Then onControlTouchEnd is called as well and that closes the dropdown again.

I tried myself at a fix, but I don’t know if it’s good enough or if it breaks anything else.

In Select.js:

  onControlTouchEnd = (event: SyntheticTouchEvent<HTMLElement>) => {
    if (this.userIsDragging) return;

    /* Firefox on a desktop touch device calls this after opening the menu, which
     closes it again. It fires both mousedown and touchend. */
    if (isTouchCapable() && isFirefox()) return;

    this.onControlMouseDown(event);
  };
  onDropdownIndicatorTouchEnd = (event: SyntheticTouchEvent<HTMLElement>) => {
    if (this.userIsDragging) return;

    /* Firefox on a desktop touch device calls this after opening the menu, which
     closes it again. It fires both mousedown and touchend. */
    if (isTouchCapable() && isFirefox()) return;

    this.onDropdownIndicatorMouseDown(event);
  };

added in util.js:

export function isFirefox() {
  try {
    return navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
  } catch (e) {
    return false;
  }
}

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
eriwincommented, Oct 31, 2019

This issue is still present in Firefox 70.0 (64-bit).

1reaction
bladeycommented, May 28, 2020

Hello -

In an effort to sustain the react-select project going forward, we’re closing old issues.

We understand this might be inconvenient but in the best interest of supporting the broader community we have to direct our efforts towards the current major version.

If you aren’t using the latest version of react-select please consider upgrading to see if it resolves any issues you’re having.

However, if you feel this issue is still relevant and you’d like us to review it - please leave a comment and we’ll do our best to get back to you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Detecting touch: it's the 'why', not the 'how' - Mozilla Hacks
One common trick has been to check for touch support and, if present, react directly to a touch event (either touchstart – as...
Read more >
platform-detect - npm
Minimalistic isomorphic library for detection of platform, runtime, APIs and more.. Latest version: 3.0.1, last published: 2 years ago.
Read more >
4 novel ways to deal with sticky :hover effects on mobile devices
Also, note that touch events such as " touchstart " are not supported on all mobile browsers, IE and Firefox mobile conspicuously being...
Read more >
Getting touchy - everything you (n)ever wanted to know about ...
you don't need touch events ... Windows 2-in-1 touchscreen laptop/tablet devices ... Android + mouse – like touch (mouse emulating touch).
Read more >
Logitech | Defy Logic - Tools to Create a Better Tomorrow
Discover the innovative world of Logitech and shop everything MX, Keyboards, Mice, Webcams, Headsets, Software, Video Conferencing, and more.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found