From 57179c186aa28cb651ad3386059fbe2a95ee2082 Mon Sep 17 00:00:00 2001 From: Jeri Peier Date: Tue, 24 Sep 2024 09:34:54 +0200 Subject: [PATCH] fix: provide jsdom support for focus trap mechanism (#3113) --- src/elements/core/a11y/focus.spec.ts | 1 + src/elements/core/a11y/focus.ts | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/elements/core/a11y/focus.spec.ts b/src/elements/core/a11y/focus.spec.ts index 317857872d..2c40068564 100644 --- a/src/elements/core/a11y/focus.spec.ts +++ b/src/elements/core/a11y/focus.spec.ts @@ -105,6 +105,7 @@ describe('focus', () => { Disabled interactive button + Disabled interactive button `; } }, diff --git a/src/elements/core/a11y/focus.ts b/src/elements/core/a11y/focus.ts index 4ac70a73b2..844b9931b4 100644 --- a/src/elements/core/a11y/focus.ts +++ b/src/elements/core/a11y/focus.ts @@ -10,7 +10,8 @@ export const IS_FOCUSABLE_QUERY = [ 'summary:not(:disabled)', '[tabindex]', ] - .map((selector) => `${selector}:not([disabled]:not([disabled-interactive]),[tabindex="-1"])`) + .map((selector) => `${selector}:not([disabled],[tabindex="-1"],[inert])`) + .concat('[disabled][disabled-interactive]:not([inert],[tabindex="-1"])') .join(','); // Note: the use of this function for more complex scenarios (with many nested elements) may be expensive.