Tab focus on clear input
Is your feature request related to a problem? Please describe
Need to double-click tab to go to the next item.
Describe the solution you'd like
Adding input to the ng-select component "tabFocusOnClear". True value sets focus to the clear element, false value skips this element.
Describe alternatives you've considered
I use keydown tab event to set manual focus to another element.
Additional context
No response
What I really want to do is add the option to skip the focus on the clear element.
example implementation
-
in ng-select.component.ts add: @input() tabFocusOnClear = true;
-
in private method _handleTab in ng-select.component.ts add: && this.tabFocusOnClear in condition statement
private _handleTab($event: KeyboardEvent) {
if (this.isOpen === false) {
if (this.showClear() && !$event.shiftKey && this.tabFocusOnClear) {
...
...
...
- in ng-select.component.html modify tabindex attribute to [tabindex]="tabFocusOnClear ? 0 : -1" in #clearButton
@if (showClear()) {
<span class="ng-clear-wrapper" [tabindex]="tabFocusOnClear ? 0 : -1" title="{{ clearAllText }}" #clearButton>
<span class="ng-clear" aria-hidden="true">×</span>
</span>
}
I also would like the option to SKIP the clear button entirely when pressing tb or shift tab. please add an attribute to make it like it was before ! (tabindex -1 instead of zero)
~Related to 'tab', but not necessarily to this issue ... in ng-select version 12.0.7, with 'tagging ' enabled, pressing tab before pressing enter with text in the input field DUPLICATES all of those entries!~ --> Nevermind that last sentence. I made a mistake.
@boltex care to contribute?
Closed in #2546