Skip to content

F5 and browser reload shortcuts briefly open a focused closed select #1431

Description

@jennlee20

Reproduction

  1. Open the official Choices.js demo with a single select.
  2. Select an option so the generated outer Choices container retains focus.
  3. Keep focus on the control and press F5.

Actual behavior

Before the browser reload begins, the closed dropdown opens briefly. The container receives is-open and sometimes is-flipped, producing a visible flash of the option list.

Ctrl+R and Cmd+R can exhibit the same behavior because the modifier-only Control or Meta keydown opens the closed dropdown before the R key arrives.

Expected behavior

Browser and system shortcuts such as F5, Ctrl+R, Cmd+R, and their hard-reload variants should not open a closed select. The browser reload itself should continue normally.

Investigation

Reproduced with Choices.js v11.2.4 in Chromium. The container capture-phase keydown handler reaches _onKeyDown(). When the dropdown is closed and the element is not a text input, keys other than Escape, Tab, and Shift fall through to showDropdown(). Function keys and modifier-only keys therefore use the same opening path as interactive select keys.

This is similar to the over-broad keyboard-opening behavior discussed in #1246, but the symptom here is specifically the dropdown flash immediately before a browser reload.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions