Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion components/dashboard/src/components/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ type Props = {
children: ReactNode;
visible: boolean;
closeable?: boolean;
disableFocusLock?: boolean;
className?: string;
onClose: () => void;
onEnter?: () => boolean | Promise<boolean>;
Expand All @@ -37,6 +38,7 @@ export const Modal: FC<Props> = ({
visible,
children,
closeable = true,
disableFocusLock = false,
className,
onClose,
onEnter,
Expand Down Expand Up @@ -104,7 +106,12 @@ export const Modal: FC<Props> = ({
>
{/* Modal outer-container for positioning */}
<div className="flex justify-center items-center w-screen h-screen">
<FocusOn autoFocus onClickOutside={handleClickOutside} onEscapeKey={handleEscape}>
<FocusOn
autoFocus
onClickOutside={handleClickOutside}
onEscapeKey={handleEscape}
focusLock={!disableFocusLock}
>
{/* Visible Modal */}
<div
className={cn(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ export const AddPaymentMethodModal: FC<Props> = ({ attributionId, clientSecret,
);

return (
<Modal visible={true} onClose={onClose}>
// Because we potentially have an 3DS verification iframe (appended to document.body) don't lock focus to modal
<Modal visible={true} onClose={onClose} disableFocusLock>
<ModalHeader>Add Payment Method</ModalHeader>
{!stripePromise ? (
<ModalBody>
Expand Down