Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: clicking a select when editing a color token now keeps the modal open #2892

Closed
Closed
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@ const EditTokenFormModal: React.FC<React.PropsWithChildren<React.PropsWithChildr
}
}, [dispatch, showAutoSuggest]);

const handleEditTokenModalClose = React.useCallback(() => {
/**
* Temporary fix - Radix UI leaves `pointer-events: none` on body when dialog is closed
* Future fix - upgrade the Dialog in our DS (https://github.com/tokens-studio/ds/issues/219)
* */
setTimeout(() => {
document.body.style.pointerEvents = 'auto';
}, 1000);
}, []);

if (!editToken) {
return null;
}
Expand All @@ -35,8 +45,8 @@ const EditTokenFormModal: React.FC<React.PropsWithChildren<React.PropsWithChildr
compact
size="large"
isOpen
modal={false}
close={handleReset}
onCloseCallback={handleEditTokenModalClose}
// eslint-disable-next-line no-nested-ternary
title={editToken.status === EditTokenFormStatus.CREATE ? t('newToken')
: editToken.status === EditTokenFormStatus.DUPLICATE ? t('duplicateToken') : editToken.initialName}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export type ModalProps = {
showClose?: boolean;
backArrow?: boolean
close: () => void;
onCloseCallback?: () => void;
modal?: boolean;
onInteractOutside?: (event: Event) => void;
};
Expand Down Expand Up @@ -89,6 +90,7 @@ export function Modal({
modal = true,
backArrow = false,
onInteractOutside,
onCloseCallback,
}: ModalProps) {
const handleClose = React.useCallback(() => {
close();
Expand All @@ -97,6 +99,9 @@ export function Modal({
const handleOnOpenChange = React.useCallback(
(open) => {
if (!open) {
if (onCloseCallback) {
onCloseCallback();
}
close();
}
},
Expand Down
Loading