Skip to content

Commit 6908fd0

Browse files
committed
chore: conditionally call window.matchMedia in isMotionDisabled
1 parent 8ef08a7 commit 6908fd0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/internal/visual-mode/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { awsuiVisualRefreshFlag, getGlobal } from '../global-flags';
1212
export function isMotionDisabled(element: HTMLElement): boolean {
1313
return (
1414
!!findUpUntil(element, node => node.classList.contains('awsui-motion-disabled')) ||
15-
(window.matchMedia?.('(prefers-reduced-motion: reduce)').matches ?? false)
15+
(element?.ownerDocument?.defaultView?.matchMedia?.('(prefers-reduced-motion: reduce)')?.matches ?? false)
1616
);
1717
}
1818

0 commit comments

Comments
 (0)