From 70da72c5f727e5364851c7dfa3c042023a2de4a9 Mon Sep 17 00:00:00 2001 From: Lukas Weiss Date: Mon, 8 Jan 2024 12:01:02 +0100 Subject: [PATCH] fix type of dialog's initial-focus-ref prop --- src/components/dialog/Dialog/Dialog.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/dialog/Dialog/Dialog.tsx b/src/components/dialog/Dialog/Dialog.tsx index 415ff682..ba31693d 100644 --- a/src/components/dialog/Dialog/Dialog.tsx +++ b/src/components/dialog/Dialog/Dialog.tsx @@ -1,6 +1,6 @@ import { Dialog as HeadlessDialog } from '@headlessui/react' import classNames from 'classnames' -import { ReactElement, useRef } from 'react' +import { MutableRefObject, ReactElement, useRef } from 'react' import { useTheme } from '../../../framework' import { ClassNameProps } from '../../types' import { DialogContext } from '../DialogContext' @@ -9,7 +9,7 @@ import { DialogPosition, DialogSize } from '../types' export type DialogProps = ClassNameProps & { isOpen?: boolean onDismiss?: () => void - initialFocusRef?: React.RefObject + initialFocusRef?: MutableRefObject size?: DialogSize children?: ReactElement mobilePosition?: DialogPosition @@ -32,8 +32,8 @@ export function Dialog({ ...props }: DialogProps): ReactElement { const { dialog } = useTheme() - const nullRef = useRef(null) - const initialFocusRef = initialFocusRefProp ?? nullRef + const panelRef = useRef(null) + const initialFocusRef = initialFocusRefProp ?? panelRef return ( @@ -50,7 +50,7 @@ export function Dialog({ {...props} >