Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 2 additions & 13 deletions packages/@react-aria/overlays/src/useModalOverlay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,15 @@
*/

import {ariaHideOutside} from './ariaHideOutside';
import {AriaOverlayProps, useOverlay} from './useOverlay';
import {DOMAttributes} from '@react-types/shared';
import {mergeProps} from '@react-aria/utils';
import {OverlayTriggerState} from '@react-stately/overlays';
import {RefObject, useEffect} from 'react';
import {useOverlay} from './useOverlay';
import {useOverlayFocusContain} from './Overlay';
import {usePreventScroll} from './usePreventScroll';

export interface AriaModalOverlayProps {
/**
* Whether to close the modal when the user interacts outside it.
* @default false
*/
isDismissable?: boolean,
/**
* Whether pressing the escape key to close the modal should be disabled.
* @default false
*/
isKeyboardDismissDisabled?: boolean
}
export interface AriaModalOverlayProps extends AriaOverlayProps {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We discussed adding shouldCloseOnInteractOutside to usePopover for submenus today, leaning towards being fine adding it there and for useModalOverlay as well as you've done here. I'd personally would prefer just adding shouldCloseOnInteractOutside only here instead of all the overlay props until we get use cases for the rest of those props but happy for the rest of the team to weigh in.

Would you mind adding a basic test for this? You can probably add a new test file for useModalOverlay or for the RAC Modal since it extends from AriaModalOverlayProps. https://github.com/adobe/react-spectrum/blob/main/packages/%40react-aria/overlays/test/useModal.test.js or any of the tests in https://github.com/adobe/react-spectrum/tree/main/packages/react-aria-components/test could serve as a guide

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review and sorry for the delay, we had an onsite at work which naturally took all my attention last week.

Good to hear - I'll look to hack together a test this week.


export interface ModalOverlayAria {
/** Props for the modal element. */
Expand Down