diff --git a/.changeset/shaggy-bears-tan.md b/.changeset/shaggy-bears-tan.md new file mode 100644 index 0000000000..96475a3e4a --- /dev/null +++ b/.changeset/shaggy-bears-tan.md @@ -0,0 +1,5 @@ +--- +"@digdir/designsystemet-react": patch +--- + +Modal: remove `FloatingFocusManager` diff --git a/packages/react/src/components/Modal/ModalDialog.tsx b/packages/react/src/components/Modal/ModalDialog.tsx index 7394788735..42ee5ecf40 100644 --- a/packages/react/src/components/Modal/ModalDialog.tsx +++ b/packages/react/src/components/Modal/ModalDialog.tsx @@ -1,8 +1,4 @@ -import { - FloatingFocusManager, - useFloating, - useMergeRefs, -} from '@floating-ui/react'; +import { useMergeRefs } from '@floating-ui/react'; import { Slot } from '@radix-ui/react-slot'; import cl from 'clsx/lite'; import type { DialogHTMLAttributes } from 'react'; @@ -48,7 +44,6 @@ export const ModalDialog = forwardRef( // This local ref is used to make sure the modal works without a ModalRoot const modalDialogRef = useRef(null); - const { context } = useFloating(); const { modalRef, setOpen, setCloseModal } = useContext(ModalContext); const open = useModalState(modalDialogRef); @@ -119,12 +114,7 @@ export const ModalDialog = forwardRef( onCancel={onCancel} {...rest} > - {open && ( - - {/* biome-ignore lint/complexity/noUselessFragments: Workaround for @radix-ui/react-slot support */} - <>{children} - - )} + {children} ); },