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

Shift+Tab keybinding does not work in quick pick #180862

Open
diminutivesloop opened this issue Apr 25, 2023 · 6 comments
Open

Shift+Tab keybinding does not work in quick pick #180862

diminutivesloop opened this issue Apr 25, 2023 · 6 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug quick-pick Quick-pick widget issues
Milestone

Comments

@diminutivesloop
Copy link
Contributor

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.78.0-insider
  • OS Version: Darwin x64 22.4.0

Steps to Reproduce:
I've added keybindings to enable moving forward and backwards through quick open suggestions (similar to how search suggestions work in Firefox). However while the "tab" keybinding works as expected, when I activate the "shift+tab" keybinding it deselects the currently selected item in the quick pick and does nothing else. Note that I've disabled all other bindings for the same key combination. Also it's worth pointing out that these keybindings don't interfere with accessibility as I still have full keyboard access via "option+tab" and "shift+option+tab".

keybindings.json:

[
    {
        "key": "tab",
        "command": "workbench.action.quickOpenSelectNext",
        "when": "inQuickOpen"
      },
      {
        "key": "shift+tab",
        "command": "workbench.action.quickOpenSelectPrevious",
        "when": "inQuickOpen"
    },
    {
        "key": "shift+tab",
        "command": "-workbench.action.terminal.focusAccessibleBuffer",
        "when": "accessibilityModeEnabled && terminalHasBeenCreated && terminalTabFocusMode && !terminalAccessibleBufferFocus || accessibilityModeEnabled && terminalProcessSupported && terminalTabFocusMode && !terminalAccessibleBufferFocus"
    },
    {
        "key": "shift+tab",
        "command": "-acceptAlternativeSelectedSuggestion",
        "when": "suggestWidgetHasFocusedSuggestion && suggestWidgetVisible && textInputFocus"
    },
    {
        "key": "shift+tab",
        "command": "-insertPrevSuggestion",
        "when": "hasOtherSuggestions && textInputFocus && !inSnippetMode && !suggestWidgetVisible && config.editor.tabCompletion == 'on'"
    },
    {
        "key": "shift+tab",
        "command": "-jumpToPrevSnippetPlaceholder",
        "when": "editorTextFocus && hasPrevTabstop && inSnippetMode"
    },
    {
        "key": "shift+tab",
        "command": "-outdent",
        "when": "editorTextFocus && !editorReadonly && !editorTabMovesFocus"
    },
    {
        "key": "shift+tab",
        "command": "workbench.action.closeWindow",
        "when": "!editorIsOpen && !multipleEditorGroups"
    }
]

keyboard shortcuts troubleshooting logs:

2023-04-25 13:45:11.026 [info] [KeybindingService]: / Received  keydown event - modifiers: [], code: Tab, keyCode: 9, key: Tab
2023-04-25 13:45:11.055 [info] [KeybindingService]: | Converted keydown event - modifiers: [], code: Tab, keyCode: 2 ('Tab')
2023-04-25 13:45:11.056 [info] [KeybindingService]: | Resolving [Tab]
2023-04-25 13:45:11.056 [info] [KeybindingService]: \ From 10 keybinding entries, matched workbench.action.quickOpenSelectNext, when: inQuickOpen, source: user.
2023-04-25 13:45:11.056 [info] [KeybindingService]: + Invoking command workbench.action.quickOpenSelectNext.
2023-04-25 13:45:15.198 [info] [KeybindingService]: / Received  keydown event - modifiers: [shift], code: ShiftLeft, keyCode: 16, key: Shift
2023-04-25 13:45:15.198 [info] [KeybindingService]: | Converted keydown event - modifiers: [shift], code: ShiftLeft, keyCode: 4 ('Shift')
2023-04-25 13:45:15.198 [info] [KeybindingService]: \ Keyboard event cannot be dispatched in keydown phase.
2023-04-25 13:45:27.314 [info] [KeybindingService]: + Ignoring single modifier shift due to it being pressed together with other keys.
@TylerLeonhardt
Copy link
Member

/duplicate #98479

@VSCodeTriageBot VSCodeTriageBot added the *duplicate Issue identified as a duplicate of another issue(s) label Apr 26, 2023
@VSCodeTriageBot
Copy link
Collaborator

Thanks for creating this issue! We figured it's covering the same as another one we already have. Thus, we closed this one as a duplicate. You can search for similar existing issues. See also our issue reporting guidelines.

Happy Coding!

@VSCodeTriageBot VSCodeTriageBot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 26, 2023
@diminutivesloop
Copy link
Contributor Author

Not sure this is properly a duplicate of #98479. I'm not having issues overriding the quick pick navigation in general—I just can't get it to work for this specific keyboard shortcut. For example I already have vim-like keybindings in place for the same commands and they work perfectly fine.

  {
    "key": "alt+j",
    "command": "workbench.action.quickOpenSelectNext",
    "when": "inQuickOpen"
  },
  {
    "key": "alt+k",
    "command": "workbench.action.quickOpenSelectPrevious",
    "when": "inQuickOpen"
  },

@TylerLeonhardt TylerLeonhardt added bug Issue identified by VS Code Team member as probable bug quick-pick Quick-pick widget issues and removed *duplicate Issue identified as a duplicate of another issue(s) labels Apr 27, 2023
@TylerLeonhardt TylerLeonhardt added this to the Backlog milestone Apr 27, 2023
@TylerLeonhardt
Copy link
Member

I believe the issue is in these lines:

if (event.shiftKey && event.target === stops[0]) {
// Clear the focus from the list in order to allow
// screen readers to read operations in the input box.
dom.EventHelper.stop(e, true);
list.clearFocus();
} else if (!event.shiftKey && event.target === stops[stops.length - 1]) {
dom.EventHelper.stop(e, true);
stops[0].focus();
}

Where Shift+Tab is handled to clear the focus... the intent is that it would clear only if the first item was selected, for accessibility... but the code has a bug in it.

@catay7818
Copy link

I just ran into this exact issue when attempting to add the same keyboard shortcuts. I like using "tab" and "shift+tab" to navigate options, then "enter" to invoke the selected option. It saves my right hand a trip to the arrow keys.

This works well with the commands "selectNextSuggestion" and "selectPrevSuggestion" for navigating autocomplete suggestions for code in the text editor, and would be great if we could configure this for quick open selections as well!

@jensenojs
Copy link

jensenojs commented Jul 29, 2023

same problem, have to use <ctrl+tab> instead in workbench.action.quickOpenSelectPrevious when inQuickOpen

however, i found that <shift+tab> can be used normally in code completion scenarios, that is good news.

    {
        "key": "tab",
        "command": "selectNextSuggestion",
        "when": "editorTextFocus && suggestWidgetMultipleSuggestions && suggestWidgetVisible"
    },
    {
        "key": "shift+tab",
        "command": "selectPrevSuggestion",
        "when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus || suggestWidgetVisible && textInputFocus && !suggestWidgetHasFocusedSuggestion"
    },

mac m2 air

Version: 1.80.2 (Universal)
Commit: 2ccd690

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug quick-pick Quick-pick widget issues
Projects
None yet
Development

No branches or pull requests

5 participants