diff --git a/projects/kit/components/input-password/input-password.component.ts b/projects/kit/components/input-password/input-password.component.ts index 00e5dfea14ea7..8b8d2efb6e2de 100644 --- a/projects/kit/components/input-password/input-password.component.ts +++ b/projects/kit/components/input-password/input-password.component.ts @@ -31,8 +31,8 @@ import { } from '@taiga-ui/core'; import {TUI_PASSWORD_TEXTS} from '@taiga-ui/kit/tokens'; import {PolymorpheusContent} from '@tinkoff/ng-polymorpheus'; -import {combineLatest, EMPTY, Observable, timer} from 'rxjs'; -import {map, startWith, takeUntil} from 'rxjs/operators'; +import {combineLatest, EMPTY, Observable} from 'rxjs'; +import {map, startWith} from 'rxjs/operators'; import { TUI_INPUT_PASSWORD_OPTIONS, @@ -128,23 +128,9 @@ export class TuiInputPasswordComponent togglePasswordVisibility(): void { this.isPasswordHidden = !this.isPasswordHidden; - - this.reuseCursorPosition(); } protected getFallbackValue(): string { return ''; } - - private reuseCursorPosition(): void { - const {selectionStart: start = 0, selectionEnd: end = 0} = - this.textfield?.nativeFocusableElement ?? {}; - - timer(0) - .pipe(takeUntil(this.destroy$)) - .subscribe( - () => - this.textfield?.nativeFocusableElement?.setSelectionRange(start, end), - ); - } } diff --git a/projects/kit/components/input-password/input-password.template.html b/projects/kit/components/input-password/input-password.template.html index 0f2527eab2795..7a59d909c5f67 100644 --- a/projects/kit/components/input-password/input-password.template.html +++ b/projects/kit/components/input-password/input-password.template.html @@ -35,6 +35,8 @@ [tuiHintAppearance]="(computedAppearance$ | async) || ''" [tuiHintDirection]="hintOptions?.direction || 'bottom-left'" (click)="togglePasswordVisibility()" + (mousedown.silent.prevent)="(0)" + (mouseup.silent.prevent)="(0)" >