1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-11 13:53:34 +00:00
Files
browser/libs/components/src/a11y/a11y-title.directive.ts
Bryan Cunningham dc953b3945 Revert using tooltip in appA11yTitle directive (#17787)
* revert using tooltip in title directive

* add back tooltip delay from revert

* add back label to carousel buttons

* fix documentation that does not need reverted

* remove unnecessary label attr
2025-12-02 16:03:06 -05:00

24 lines
703 B
TypeScript

import { Directive, effect, ElementRef, input } from "@angular/core";
import { setA11yTitleAndAriaLabel } from "./set-a11y-title-and-aria-label";
@Directive({
selector: "[appA11yTitle]",
})
export class A11yTitleDirective {
readonly title = input.required<string>({ alias: "appA11yTitle" });
constructor(private el: ElementRef) {
const originalTitle = this.el.nativeElement.getAttribute("title");
const originalAriaLabel = this.el.nativeElement.getAttribute("aria-label");
effect(() => {
setA11yTitleAndAriaLabel({
element: this.el.nativeElement,
title: originalTitle ?? this.title(),
label: originalAriaLabel ?? this.title(),
});
});
}
}