1
New! Save questions or answers and organize your favorite content.
Learn more.
In a DOM where there is multiple focus elements . The user can traverse the focus elements using tab , or traverse reverse by using shift + tab.
Listening on the focusin event how can we know whether it was triggered by TAB or Shift TAB ?
document.querySelector('#sample').addEventListener('focusin', function(){ if(isFromTAB){ // DO traverse }else{ // DO different thing } });
asked Oct 22, 2021 at 9:37
3
You can check the relatedTarget property of the event. For a focusin event, the relatedTarget property identifies the element that lost focus:
document.querySelector('#b').addEventListener('focusin', (e) => { if (e.relatedTarget?.id === 'a') { console.log('tab'); } else if (e.relatedTarget?.id === 'c') { console.log('shift tab'); } });<input id="a"> <input id="b"> <input id="c">
answered Oct 22, 2021 at 9:46
Robby CornelissenRobby Cornelissen
85.5k21 gold badges122 silver badges144 bronze badges
6
JetBrains Rider allows you to use the Tab and Shift+Tab keys to quickly move text selection to the next or previous code element without having to use the mouse or the cursor keys. This way you can quickly jump to the next or previous logical piece of code. Here are a couple of
examples: When editing a method call, repeatedly hitting Tab will first select all arguments (in case you want to replace all of them), then each argument will be selected in turn. When editing a for statement, Tab will select the initializer statement, then the terminating condition and then the iterator
statement. Shift+Tab will do the same, but in reverse. By default, JetBrains Rider enables structural
navigation with Tab/Shift+Tab unless your caret is not at indenting (before the first non-whitespace character). So you can still use Tab/Shift+Tab to indent/outdent the line. If necessary, you configure the behavior of these keys on the page of JetBrains Rider
settings
Ctrl+Alt+S: you can either disable this altogether, or specify when the standard behavior of Tab/Shift+Tab should be preserved. You can also press Tab to jump out of brackets (curly braces, square brackets, and parentheses) as well as out of quotes when your caret
is right before the closing one.
This comes in handy when your caret is automatically set inside brackets or quotes created with code completion, and you want to continue typing without reaching down to the right arrow key.
By default, this behavior is enabled for brackets and disabled for quotes in string literals. You can change the defaults on the page of JetBrains Rider settings Ctrl+Alt+S:
Last modified: 20 August 2021
Check your Options
You can use (Tab) key either to automatically indent a paragraph or to demote a paragraph to the next outlined level.
You can use (Shift + Tab) or (Backspace) to remove an indent or to promote a paragraph to the previous outlined level.
Check your (Tools > AutoCorrect Options)(Autoformat as you type tab, Set left- and first-indent with tabs and backspaces).
Tabbing a Regular Line
When this option is switched off pressing the Tab key will result in the following:
When this option is switched on pressing the Tab key will automatically move the first line indent.
The smart tag will be displayed if you have the following
option selected:
(Tools > AutoCorrect Options)(AutoCorrect tab, Show AutoCorrect Options buttons).
© 2022 Better Solutions Limited. All Rights Reserved. © 2022 Better Solutions Limited TopPrevNext