downshift-js / downshift-js/downshift

Inconsistent state change when browser tab is switched in `useSelect`

Open
#1,157 5 comments 0 reactions 0 assignees View on GitHub
help wanted needs investigation
Dominant language
JavaScript
Stars
12.3k
Forks
936
PR merge metrics
No merged PRs in 30d

Description

- `downshift` version: 6.0.5
- `node` version: latest
- `npm` (or `yarn`) version: latest

**Relevant code or config**
Simple implementation of a Select component using `useSelect` hook. Behaviour is visible in your [example implementation](https://codesandbox.io/s/useselect-usage-forked-cikep)

**What you did**:

* Open the Select dropdown
* Switch back and forth with another browser tab

**What happened**:

The Select dropdown stays open / collapses inconsistently, meaning sometimes it stays open and sometimes is closes

**Reproduction repository**:

https://codesandbox.io/s/useselect-usage-forked-cikep

**Problem description**:

Inconsistent state change in `useSelect` when switching browser tabs

**Suggested solution**:

I don't think there is a clear industry standard for this behaviour. As far as I tested `useCombobox` does collapse on tab switch, so maybe that's will be good here too. If not too difficult, could create a prop to manipulate it.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.