Skip to content

Commit 9df216b

Browse files
committed
fix: scroll issue in Modal content component
1 parent d89c9c3 commit 9df216b

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

.changeset/short-pets-attack.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@strapi/design-system': minor
3+
---
4+
5+
fixed Modal Content scroll issues

packages/design-system/src/components/Modal/Modal.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import * as Dialog from '@radix-ui/react-dialog';
44
import { Cross } from '@strapi/icons';
55
import { styled } from 'styled-components';
66

7+
import { setOpacity } from '../../helpers/setOpacity';
78
import { ANIMATIONS } from '../../styles/motion';
89
import { ScrollArea, ScrollAreaProps } from '../../utilities/ScrollArea';
910
import { Flex, type FlexComponent, type FlexProps } from '../Flex';
@@ -41,18 +42,18 @@ interface ContentProps extends Dialog.DialogContentProps {}
4142
const Content = React.forwardRef<ContentElement, ContentProps>((props, forwardedRef) => {
4243
return (
4344
<Dialog.Portal>
44-
<Overlay />
45-
<ContentImpl ref={forwardedRef} {...props} />
45+
<Overlay>
46+
<ContentImpl ref={forwardedRef} {...props} />
47+
</Overlay>
4648
</Dialog.Portal>
4749
);
4850
});
4951

5052
const Overlay = styled(Dialog.Overlay)`
51-
background-color: ${(props) => props.theme.colors.neutral800};
53+
background: ${(props) => setOpacity(props.theme.colors.neutral800, 0.2)};
5254
position: fixed;
5355
inset: 0;
5456
z-index: ${(props) => props.theme.zIndices.overlay};
55-
opacity: 0.2;
5657
5758
@media (prefers-reduced-motion: no-preference) {
5859
animation: ${ANIMATIONS.overlayFadeIn} ${(props) => props.theme.motion.timings['200']}

0 commit comments

Comments
 (0)