mgr/dashboard: Skip tab focus on "show/hide password" button

Signed-off-by: Ricardo Marques <rimarques@suse.com>
This commit is contained in:
Ricardo Marques 2018-07-21 12:10:14 +01:00
parent 9edff075c5
commit 3cec4bd3dc

View File

@ -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();
}