Skip to content

Commit

Permalink
ModalOverlay animation added for fade-in and fade-out
Browse files Browse the repository at this point in the history
  • Loading branch information
ty2k committed Sep 19, 2024
1 parent 66426e9 commit 0a686e4
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions packages/react-components/src/components/Modal/Modal.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,30 @@
height: 100vh;
width: 100vw;
z-index: 1000;
}
.react-aria-ModalOverlay:has(.bcds-react-aria-Modal)[data-entering] {
animation: modal-fade 200ms;
}
.react-aria-ModalOverlay:has(.bcds-react-aria-Modal)[data-exiting] {
animation: modal-fade 150ms reverse ease-in;
}
@media (prefers-reduced-motion) {
/* Don't animate modal fade in/out if prefers-reduced-motion is on */
.react-aria-ModalOverlay:has(.bcds-react-aria-Modal)[data-entering] {
animation: unset;
}
.react-aria-ModalOverlay:has(.bcds-react-aria-Modal)[data-exiting] {
animation: unset;
}
}

&[data-entering] {
animation-delay: 200ms;
@keyframes modal-fade {
from {
opacity: 0;
}
&[data-exiting] {
animation-delay: 200ms;

to {
opacity: 1;
}
}

Expand Down

0 comments on commit 0a686e4

Please sign in to comment.