From cd77c9f3143ecc06a9d86cc623fd68c3fab6cbb7 Mon Sep 17 00:00:00 2001 From: Kalmar Lorand Date: Tue, 14 May 2024 16:51:07 +0300 Subject: [PATCH 1/2] [FocusTrap] update getTabbable function return type --- packages/mui-base/src/FocusTrap/FocusTrap.types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/mui-base/src/FocusTrap/FocusTrap.types.ts b/packages/mui-base/src/FocusTrap/FocusTrap.types.ts index 70c6861eeaf4f7..8fc3e138a3a70b 100644 --- a/packages/mui-base/src/FocusTrap/FocusTrap.types.ts +++ b/packages/mui-base/src/FocusTrap/FocusTrap.types.ts @@ -10,7 +10,7 @@ export interface FocusTrapProps { * For instance, you can provide the "tabbable" npm dependency. * @param {HTMLElement} root */ - getTabbable?: (root: HTMLElement) => ReadonlyArray; + getTabbable?: (root: HTMLElement) => ReadonlyArray; /** * This prop extends the `open` prop. * It allows to toggle the open state without having to wait for a rerender when changing the `open` prop. From 004f1c1f752640cb88531f20456aff5ebbf8cd21 Mon Sep 17 00:00:00 2001 From: ZeeshanTamboli Date: Fri, 23 Aug 2024 11:12:56 +0530 Subject: [PATCH 2/2] Fix type of getTabbable prop in Unstable Focus Trap in Material UI --- packages/mui-base/src/FocusTrap/FocusTrap.types.ts | 2 +- packages/mui-material/src/Unstable_TrapFocus/FocusTrap.tsx | 2 +- packages/mui-material/src/Unstable_TrapFocus/FocusTrap.types.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/mui-base/src/FocusTrap/FocusTrap.types.ts b/packages/mui-base/src/FocusTrap/FocusTrap.types.ts index 462100ec696479..be9cf5ee1e93c3 100644 --- a/packages/mui-base/src/FocusTrap/FocusTrap.types.ts +++ b/packages/mui-base/src/FocusTrap/FocusTrap.types.ts @@ -10,7 +10,7 @@ export interface FocusTrapProps { * For instance, you can provide the "tabbable" npm dependency. * @param {HTMLElement} root */ - getTabbable?: (root: HTMLElement) => ReadonlyArray; + getTabbable?: (root: HTMLElement) => ReadonlyArray; /** * This prop extends the `open` prop. * It allows to toggle the open state without having to wait for a rerender when changing the `open` prop. diff --git a/packages/mui-material/src/Unstable_TrapFocus/FocusTrap.tsx b/packages/mui-material/src/Unstable_TrapFocus/FocusTrap.tsx index 264403eb00eac9..7a404740af6b68 100644 --- a/packages/mui-material/src/Unstable_TrapFocus/FocusTrap.tsx +++ b/packages/mui-material/src/Unstable_TrapFocus/FocusTrap.tsx @@ -270,7 +270,7 @@ function FocusTrap(props: FocusTrapProps): React.JSX.Element { return; } - let tabbable: ReadonlyArray | HTMLElement[] = []; + let tabbable: ReadonlyArray = []; if ( doc.activeElement === sentinelStart.current || doc.activeElement === sentinelEnd.current diff --git a/packages/mui-material/src/Unstable_TrapFocus/FocusTrap.types.ts b/packages/mui-material/src/Unstable_TrapFocus/FocusTrap.types.ts index be9cf5ee1e93c3..462100ec696479 100644 --- a/packages/mui-material/src/Unstable_TrapFocus/FocusTrap.types.ts +++ b/packages/mui-material/src/Unstable_TrapFocus/FocusTrap.types.ts @@ -10,7 +10,7 @@ export interface FocusTrapProps { * For instance, you can provide the "tabbable" npm dependency. * @param {HTMLElement} root */ - getTabbable?: (root: HTMLElement) => ReadonlyArray; + getTabbable?: (root: HTMLElement) => ReadonlyArray; /** * This prop extends the `open` prop. * It allows to toggle the open state without having to wait for a rerender when changing the `open` prop.