microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.19k stars 29.29k forks source link

Tab press in search panel should navigate to next text field #68166

Open Ryan-Haines opened 5 years ago

Ryan-Haines commented 5 years ago

When pressing tab in the search panel with CTRL+SHIFT+F, I should be able to:

  1. enter some text in the 'search' field
  2. press tab
  3. enter some text in the 'files to include' field
  4. press enter.

But it is necessary to press tab 5(!) times to get from the 'search' field to the 'files to include' field.

According to #34676 this was fixed in 1.25, but I'm running version 1.31.0 and I still see the issue.

vscodebot[bot] commented 5 years ago

(Experimental duplicate detection) Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

roblourens commented 5 years ago

34676 was about search and replace, it sounds like you are trying to get to "files to include". I have looked into this before and it was surprisingly difficult. I recommend using cmd+down to get there in a single keypress.

I'll leave this open and try to take another look.

timkelty commented 5 years ago

@roblourens +1 to this…

IMO, it is very disorienting when tab/shift+tab doesn't advance through text inputs.

In this case it technically does, but the tabindex order with the icon buttons (match case, match word, regex, Toggle search details, use exclude settings) gets in the way.

I think the easiest and most sensible solution might be to just change the tabindex of the icon buttons to be after all the text inputs.

As of now, if you try and replace search.focus.nextInputBox and search.focus.previousInputBox with tab/shift-tab, it still doesn't work, as tab natively wants to cycle through inputs.

You'll end up with something like this, which doesn't work:

  {
    "key": "tab",
    "command": "search.focus.nextInputBox",
    "when": "inputBoxFocus && searchViewletVisible"
  },
  {
    "key": "cmd+down",
    "command": "-search.focus.nextInputBox",
    "when": "inputBoxFocus && searchViewletVisible"
  },
  {
    "key": "shift+tab",
    "command": "search.focus.previousInputBox",
    "when": "inputBoxFocus && searchViewletVisible && !searchInputBoxFocus"
  },
  {
    "key": "cmd+up",
    "command": "-search.focus.previousInputBox",
    "when": "inputBoxFocus && searchViewletVisible && !searchInputBoxFocus"
  }
roblourens commented 5 years ago

tabindex is global on the page, you can't easily use it to shift the order of a few elements in the tab order without setting it on everything, as far as I know.

dwelle commented 5 years ago

In the meantime, we can add these shortcuts:

{
    "key": "tab",
    "command": "search.focus.nextInputBox",
    "when": "inputBoxFocus && searchViewletVisible"
},
{
    "key": "shift+tab",
    "command": "search.focus.previousInputBox",
    "when": "inputBoxFocus && searchViewletVisible"
},

Works fine with Find in files, but for some reason doesn't fully work for Replace in files where it jumps only between search & replace fields, but not to files to include field (from replace field). It seems to clash with some other Tab hotkey, but I couldn't figure out which (it may be level deeper than userland).

JonnieCache commented 1 year ago

this bothers me on a daily basis