Keep contextual filling help within modal form focus scopes
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-11-17 10:08:07 +02:00
parent ded66878af
commit 953602fb85
4 changed files with 51 additions and 7 deletions
+5 -3
View File
@@ -50,7 +50,7 @@ export function formHelpControlVisible(control: HTMLElement): boolean {
export function formHelpControls(document: Document): HTMLElement[] {
const roots = document.querySelectorAll(
'main,[role="main"],[role="dialog"]',
'main,[role="main"],[role="dialog"],dialog[open]',
);
return [
...new Set(
@@ -68,7 +68,7 @@ export function formHelpGroupControls(
control: HTMLElement | null,
): HTMLElement[] {
const scope = control?.closest(
'form,fieldset,[data-form-help-context],[role="dialog"]',
'form,fieldset,[data-form-help-context],[role="dialog"],dialog[open]',
);
const controls = formHelpControls(document);
return scope ? controls.filter((node) => scope.contains(node)) : controls;
@@ -156,7 +156,9 @@ export function formHelpStep(control: HTMLElement): {
code: investment.dataset.investmentStep ?? '',
context: 'investor-path',
};
const scope = control.closest('fieldset,section,form,[role="dialog"]');
const scope = control.closest(
'fieldset,section,form,[role="dialog"],dialog[open]',
);
const titleId = scope?.getAttribute('aria-labelledby');
const title =
(titleId