Skip to content

Move focus to previous control (Keyboard navigation, SHIFT - TAB) #6424

Open

Description

@gsartori

Happy to see Select2 alive :)

I'm the author of Dueuno (https://dueuno.com), an Open Source framework built on top of Apache Grails we use to build business applications. We have been using Select2 for some time now and we are required to implement keyboard navigation on the applications we develop with the framewrok.

I've tryied to fix the below issue with no luck:
- Pressing SHIFT + TAB does not move the focus to the previous control.

We are using the Bootstrap template, in case it makes any difference.
Any help would be appreciated.

Cheers,
Gianluca

Activity

  1. changed the title [-]Select previous control (Keyboard navigation, SHIFT - TAB)[/-] [+]Move focus to previous control (Keyboard navigation, SHIFT - TAB)[/+] on Jul 28, 2026
  2. sridharkalaibala commented on Sep 13, 2026

    @sridharkalaibala

    I reproduced this with the default Select2 theme, so Bootstrap is not required for the open-dropdown case.

    In the current keyboard handler, when the dropdown is open, both Enter and Tab trigger results:select and call preventDefault(). That branch does not check shiftKey, so Shift+Tab selects the highlighted result instead of performing the browser's backward focus navigation.

    Chromium checks with an input before and after the Select2 control:

    Sequence Single select Multiple select
    Closed dropdown, Shift+Tab Previous input receives focus Previous input receives focus
    Open dropdown, Shift+Tab Dropdown closes; focus remains on Select2 Highlighted Alpha is selected; focus remains on Select2
    Open dropdown, Escape, then Shift+Tab Previous input receives focus Previous input receives focus, no option added

    Escape followed by Shift+Tab is therefore a working keyboard route with the tested default behavior. It is not equivalent to fixing one-keystroke backward navigation. A library change should explicitly decide whether Shift+Tab should close without committing a result and allow native focus movement, while preserving the intended unmodified Tab behavior.

    Does your failure occur only while the dropdown is open, or also when it is closed? I tested single/multiple controls with the current bundle and default theme, not Dueuno's Bootstrap integration.

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