From 624da8d8b203d89098aa15ff481b1301ce67d45c Mon Sep 17 00:00:00 2001 From: Sangjin Park <58503584+healtheloper@users.noreply.github.com> Date: Tue, 5 Nov 2024 07:22:06 +0900 Subject: [PATCH] fix(aria-hidden): skip empty elements hide (#2011) --- packages/utilities/aria-hidden/src/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/utilities/aria-hidden/src/index.ts b/packages/utilities/aria-hidden/src/index.ts index 7e66578b34..9c3fc300dd 100644 --- a/packages/utilities/aria-hidden/src/index.ts +++ b/packages/utilities/aria-hidden/src/index.ts @@ -21,6 +21,7 @@ export function ariaHidden(targetsOrFn: TargetsOrFn, options: Options = {}) { func(() => { const targets = typeof targetsOrFn === "function" ? targetsOrFn() : targetsOrFn const elements = targets.filter(Boolean) as HTMLElement[] + if (elements.length === 0) return cleanups.push(hideOthers(elements)) }), )