Skip to content

Commit

Permalink
fix(kit): prevent focusing when remove item from multi-select (#5412)
Browse files Browse the repository at this point in the history
  • Loading branch information
splincode authored Sep 18, 2023
1 parent def0c40 commit 50a3b41
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions projects/kit/components/input-tag/input-tag.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ export class TuiInputTagComponent
}

onTagEdited(value: string, index: number): void {
this.focusInput();
this.focusInput(value === '');
this.value = this.filterValue(
this.value
.map((tag, tagIndex) =>
Expand Down Expand Up @@ -518,9 +518,7 @@ export class TuiInputTagComponent
}

private focusInput(preventScroll: boolean = false): void {
if (this.nativeFocusableElement) {
this.nativeFocusableElement.focus({preventScroll});
}
this.nativeFocusableElement?.focus({preventScroll});
}

private clippedValue(value: string): string {
Expand Down
2 changes: 1 addition & 1 deletion projects/kit/components/tag/tag.template.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
class="t-icon"
[src]="icons.close"
(click)="remove($event)"
(mousedown.prevent.silent)="(0)"
(mousedown.stop.prevent.silent)="(0)"
></tui-svg>
</div>
<input
Expand Down

0 comments on commit 50a3b41

Please sign in to comment.