Skip to content

Commit

Permalink
fix(Modal): fix flaky overlay opacity color issue happening in Chrome…
Browse files Browse the repository at this point in the history
… browser

Here's a [reprod](https://codesandbox.io/s/eufemia-drawer-background-color-bug-ui417b?file=/src/App.tsx): (Shows a black overlay when opened)

Because it happen not on all Chrome browsers (all on latest) its hard to make a test that verifies the issue.
  • Loading branch information
tujoworker committed Jun 10, 2022
1 parent 8a37584 commit 21e8f90
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1918,11 +1918,11 @@ button.dnb-button::-moz-focus-inner {
from {
opacity: 0; }
to {
opacity: var(--modal-overlay-opacity); } }
opacity: 1; } }
@keyframes hide-modal-overlay {
from {
opacity: var(--modal-overlay-opacity); }
opacity: 1; }
to {
opacity: 0; } }
Expand Down Expand Up @@ -2288,8 +2288,7 @@ button.dnb-button::-moz-focus-inner {
:root {
--modal-z-index: 3000;
--modal-animation-duration: 300ms;
--modal-overlay-bg: black;
--modal-overlay-opacity: 0.32; }
--modal-overlay-bg: rgba(0, 0, 0, 0.32); }
html[data-dnb-modal-active] {
user-select: none;
Expand Down Expand Up @@ -2341,11 +2340,11 @@ html[data-dnb-modal-active] {
height: 100%;
background-color: var(--modal-overlay-bg); }
.dnb-modal-root__inner .dnb-modal__overlay {
animation: hide-modal-overlay var(--modal-animation-duration) ease-in-out forwards; }
animation: hide-modal-overlay var(--modal-animation-duration) ease-out forwards; }
.dnb-modal-root__inner:last-of-type .dnb-modal__overlay {
animation: show-modal-overlay var(--modal-animation-duration) ease-out forwards 0ms; }
animation: show-modal-overlay var(--modal-animation-duration) ease-out forwards; }
.dnb-modal-root__inner:last-of-type .dnb-modal__overlay--hide {
animation: hide-modal-overlay var(--modal-animation-duration) ease-in-out forwards; }
animation: hide-modal-overlay var(--modal-animation-duration) ease-out forwards; }
html[data-visual-test] .dnb-modal__overlay, .dnb-modal__overlay--no-animation {
animation-delay: 0ms !important;
animation-duration: 0ms !important; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1914,11 +1914,11 @@ button.dnb-button::-moz-focus-inner {
from {
opacity: 0; }
to {
opacity: var(--modal-overlay-opacity); } }
opacity: 1; } }
@keyframes hide-modal-overlay {
from {
opacity: var(--modal-overlay-opacity); }
opacity: 1; }
to {
opacity: 0; } }
Expand Down Expand Up @@ -2284,8 +2284,7 @@ button.dnb-button::-moz-focus-inner {
:root {
--modal-z-index: 3000;
--modal-animation-duration: 300ms;
--modal-overlay-bg: black;
--modal-overlay-opacity: 0.32; }
--modal-overlay-bg: rgba(0, 0, 0, 0.32); }
html[data-dnb-modal-active] {
user-select: none;
Expand Down Expand Up @@ -2337,11 +2336,11 @@ html[data-dnb-modal-active] {
height: 100%;
background-color: var(--modal-overlay-bg); }
.dnb-modal-root__inner .dnb-modal__overlay {
animation: hide-modal-overlay var(--modal-animation-duration) ease-in-out forwards; }
animation: hide-modal-overlay var(--modal-animation-duration) ease-out forwards; }
.dnb-modal-root__inner:last-of-type .dnb-modal__overlay {
animation: show-modal-overlay var(--modal-animation-duration) ease-out forwards 0ms; }
animation: show-modal-overlay var(--modal-animation-duration) ease-out forwards; }
.dnb-modal-root__inner:last-of-type .dnb-modal__overlay--hide {
animation: hide-modal-overlay var(--modal-animation-duration) ease-in-out forwards; }
animation: hide-modal-overlay var(--modal-animation-duration) ease-out forwards; }
html[data-visual-test] .dnb-modal__overlay, .dnb-modal__overlay--no-animation {
animation-delay: 0ms !important;
animation-duration: 0ms !important; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1929,11 +1929,11 @@ button.dnb-button::-moz-focus-inner {
from {
opacity: 0; }
to {
opacity: var(--modal-overlay-opacity); } }
opacity: 1; } }
@keyframes hide-modal-overlay {
from {
opacity: var(--modal-overlay-opacity); }
opacity: 1; }
to {
opacity: 0; } }
Expand Down Expand Up @@ -2299,8 +2299,7 @@ button.dnb-button::-moz-focus-inner {
:root {
--modal-z-index: 3000;
--modal-animation-duration: 300ms;
--modal-overlay-bg: black;
--modal-overlay-opacity: 0.32; }
--modal-overlay-bg: rgba(0, 0, 0, 0.32); }
html[data-dnb-modal-active] {
user-select: none;
Expand Down Expand Up @@ -2352,11 +2351,11 @@ html[data-dnb-modal-active] {
height: 100%;
background-color: var(--modal-overlay-bg); }
.dnb-modal-root__inner .dnb-modal__overlay {
animation: hide-modal-overlay var(--modal-animation-duration) ease-in-out forwards; }
animation: hide-modal-overlay var(--modal-animation-duration) ease-out forwards; }
.dnb-modal-root__inner:last-of-type .dnb-modal__overlay {
animation: show-modal-overlay var(--modal-animation-duration) ease-out forwards 0ms; }
animation: show-modal-overlay var(--modal-animation-duration) ease-out forwards; }
.dnb-modal-root__inner:last-of-type .dnb-modal__overlay--hide {
animation: hide-modal-overlay var(--modal-animation-duration) ease-in-out forwards; }
animation: hide-modal-overlay var(--modal-animation-duration) ease-out forwards; }
html[data-visual-test] .dnb-modal__overlay, .dnb-modal__overlay--no-animation {
animation-delay: 0ms !important;
animation-duration: 0ms !important; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,12 @@
opacity: 0;
}
to {
opacity: var(--modal-overlay-opacity);
opacity: 1;
}
}
@keyframes hide-modal-overlay {
from {
opacity: var(--modal-overlay-opacity);
opacity: 1;
}
to {
opacity: 0;
Expand Down
11 changes: 5 additions & 6 deletions packages/dnb-eufemia/src/components/modal/style/_modal.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
:root {
--modal-z-index: 3000;
--modal-animation-duration: 300ms;
--modal-overlay-bg: black;
--modal-overlay-opacity: 0.32;
--modal-overlay-bg: rgba(0, 0, 0, 0.32);
}

html[data-dnb-modal-active] {
Expand Down Expand Up @@ -84,17 +83,17 @@ html[data-dnb-modal-active] {
}

&-root__inner &__overlay {
animation: hide-modal-overlay var(--modal-animation-duration)
ease-in-out forwards;
animation: hide-modal-overlay var(--modal-animation-duration) ease-out
forwards;
}

&-root__inner:last-of-type &__overlay {
animation: show-modal-overlay var(--modal-animation-duration) ease-out
forwards 0ms;
forwards;

&--hide {
animation: hide-modal-overlay var(--modal-animation-duration)
ease-in-out forwards;
ease-out forwards;
}
}

Expand Down

0 comments on commit 21e8f90

Please sign in to comment.