mirror of
https://github.com/bitwarden/browser
synced 2025-12-18 01:03:35 +00:00
* [deps] Autofill: Update prettier to v3 * prettier formatting updates --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Jonathan Prusik <jprusik@classynemesis.com>
27 lines
649 B
TypeScript
27 lines
649 B
TypeScript
import { Directive, ElementRef, Input, Renderer2 } from "@angular/core";
|
|
|
|
@Directive({
|
|
selector: "[appA11yTitle]",
|
|
})
|
|
export class A11yTitleDirective {
|
|
@Input() set appA11yTitle(title: string) {
|
|
this.title = title;
|
|
}
|
|
|
|
private title: string;
|
|
|
|
constructor(
|
|
private el: ElementRef,
|
|
private renderer: Renderer2,
|
|
) {}
|
|
|
|
ngOnInit() {
|
|
if (!this.el.nativeElement.hasAttribute("title")) {
|
|
this.renderer.setAttribute(this.el.nativeElement, "title", this.title);
|
|
}
|
|
if (!this.el.nativeElement.hasAttribute("aria-label")) {
|
|
this.renderer.setAttribute(this.el.nativeElement, "aria-label", this.title);
|
|
}
|
|
}
|
|
}
|