1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-25 17:13:24 +00:00

[PM-24178] Handle focus when routed dialog closes in vault table (#18409)

This commit is contained in:
Vicki League
2026-02-20 10:01:38 -05:00
committed by GitHub
parent aa4eac7d40
commit e16503f093
14 changed files with 546 additions and 53 deletions

View File

@@ -13,6 +13,18 @@ import { Utils } from "@bitwarden/common/platform/misc/utils";
import { FocusableElement } from "../shared/focusable-element";
/**
* Helper function to query for descendents of a given el that have the AutofocusDirective
* applied to them
*
* @param el element that supports querySelectorAll
* @returns querySelectorAll results
*/
export function queryForAutofocusDescendents(el: Document | Element) {
// ensure selectors match the directive selectors
return el.querySelectorAll("[appAutofocus], [bitAutofocus]");
}
/**
* Directive to focus an element.
*
@@ -21,9 +33,7 @@ import { FocusableElement } from "../shared/focusable-element";
* Will focus the element once, when it becomes visible.
*
* If the component provides the `FocusableElement` interface, the `focus`
* method will be called. Otherwise, the native element will be focused.
*
* If selector changes, `dialog.component.ts` must also be updated
* method will be called. Otherwise, the native element will be focused. *
*/
@Directive({
selector: "[appAutofocus], [bitAutofocus]",