From 3cec4bd3dcee6f17091f2933683b4e0527f7e9c3 Mon Sep 17 00:00:00 2001 From: Ricardo Marques Date: Sat, 21 Jul 2018 12:10:14 +0100 Subject: [PATCH] mgr/dashboard: Skip tab focus on "show/hide password" button Signed-off-by: Ricardo Marques --- .../app/shared/directives/password-button.directive.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/password-button.directive.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/password-button.directive.ts index 3e152a3334ade..abfbe3a671a73 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/password-button.directive.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/password-button.directive.ts @@ -8,10 +8,10 @@ export class PasswordButtonDirective implements OnInit { @Input('cdPasswordButton') private cdPasswordButton: string; - constructor(private elementRef: ElementRef, - private renderer: Renderer2) {} + constructor(private elementRef: ElementRef, private renderer: Renderer2) {} ngOnInit() { + this.renderer.setAttribute(this.elementRef.nativeElement, 'tabindex', '-1'); this.iElement = this.renderer.createElement('i'); this.renderer.addClass(this.iElement, 'icon-prepend'); this.renderer.addClass(this.iElement, 'fa'); @@ -25,7 +25,7 @@ export class PasswordButtonDirective implements OnInit { private update() { const inputElement = this.getInputElement(); - if (inputElement && (inputElement.type === 'text')) { + if (inputElement && inputElement.type === 'text') { this.renderer.removeClass(this.iElement, 'fa-eye'); this.renderer.addClass(this.iElement, 'fa-eye-slash'); } else { @@ -38,7 +38,7 @@ export class PasswordButtonDirective implements OnInit { onClick() { const inputElement = this.getInputElement(); // Modify the type of the input field. - inputElement.type = (inputElement.type === 'password') ? 'text' : 'password'; + inputElement.type = inputElement.type === 'password' ? 'text' : 'password'; // Update the button icon/tooltip. this.update(); } -- 2.39.5