mirror of
https://github.com/bitwarden/directory-connector
synced 2025-12-05 23:53:21 +00:00
* angular 18 upgrade * wip * wip * remove @types/glob, fix jest version, use standalone: false * clean up * npm ci
28 lines
670 B
TypeScript
28 lines
670 B
TypeScript
import { Directive, ElementRef, Input, Renderer2 } from "@angular/core";
|
|
|
|
@Directive({
|
|
selector: "[appA11yTitle]",
|
|
standalone: false,
|
|
})
|
|
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);
|
|
}
|
|
}
|
|
}
|