1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-08 04:33:38 +00:00

only focus FocusableElement or host element

This commit is contained in:
William Martin
2025-05-27 22:08:56 -04:00
parent 173534b502
commit 966f5236cd

View File

@@ -14,19 +14,7 @@ export class A11yCellDirective implements FocusableElement {
private focusableChild = contentChild(FocusableElement);
getFocusTarget() {
let focusTarget: HTMLElement | undefined | null;
const focusableChild = this.focusableChild();
if (focusableChild) {
focusTarget = focusableChild.getFocusTarget();
} else {
focusTarget = this.elementRef.nativeElement.querySelector<HTMLElement>("button, a");
}
if (!focusTarget) {
return this.elementRef.nativeElement;
}
return focusTarget;
return this.focusableChild()?.getFocusTarget() ?? this.elementRef.nativeElement;
}
constructor(private elementRef: ElementRef<HTMLElement>) {}