-
Notifications
You must be signed in to change notification settings - Fork 7
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
Re-implement Modal
component using HTMLDialogElement (#461)
#544
base: master
Are you sure you want to change the base?
Changes from 1 commit
77224ee
8d6ac22
64ae3d4
06a7018
6348886
4f137dd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -1,9 +1,16 @@ | ||||||||||
// 1. Modal uses <dialog> element that uses the browser's built-in dialog functionality, so that: | ||||||||||
// * visibility of thw .root element and its backdrop is managed by the browser | ||||||||||
bedrich-schindler marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
// * positioning of the .root element and its backdrop is managed by the browser | ||||||||||
// * z-index of the .root element and its backdrop is not needed as dialog is rendered in browser's Top layer | ||||||||||
// 2. When dialogs are stacked, only the topmost dialog should have a backdrop. | ||||||||||
bedrich-schindler marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
|
||||||||||
@use "sass:map"; | ||||||||||
@use "../../styles/theme/typography"; | ||||||||||
@use "../../styles/tools/accessibility"; | ||||||||||
@use "../../styles/tools/breakpoint"; | ||||||||||
@use "../../styles/tools/reset"; | ||||||||||
@use "../../styles/tools/spacing"; | ||||||||||
@use "animations"; | ||||||||||
@use "settings"; | ||||||||||
@use "theme"; | ||||||||||
|
||||||||||
|
@@ -13,33 +20,33 @@ | |||||||||
--rui-local-max-width: calc(100% - (2 * var(--rui-local-outer-spacing))); | ||||||||||
--rui-local-max-height: calc(100% - (2 * var(--rui-local-outer-spacing))); | ||||||||||
|
||||||||||
position: fixed; | ||||||||||
left: 50%; | ||||||||||
z-index: settings.$z-index; | ||||||||||
display: flex; | ||||||||||
flex-direction: column; | ||||||||||
max-width: var(--rui-local-max-width); | ||||||||||
max-height: var(--rui-local-max-height); | ||||||||||
padding: 0; | ||||||||||
overflow-y: auto; | ||||||||||
overscroll-behavior: contain; | ||||||||||
border-radius: settings.$border-radius; | ||||||||||
background: theme.$background; | ||||||||||
box-shadow: theme.$box-shadow; | ||||||||||
transform: translateX(-50%); | ||||||||||
|
||||||||||
@include breakpoint.up(sm) { | ||||||||||
--rui-local-outer-spacing: #{theme.$outer-spacing-sm}; | ||||||||||
} | ||||||||||
} | ||||||||||
|
||||||||||
.backdrop { | ||||||||||
position: fixed; | ||||||||||
top: 0; | ||||||||||
left: 0; | ||||||||||
z-index: settings.$backdrop-z-index; | ||||||||||
width: 100vw; | ||||||||||
height: 100vh; | ||||||||||
.root:has(.root)::backdrop { | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
OK: <dialog></dialog>
<dialog></dialog> <dialog>
<dialog></dialog>
</dialog> |
||||||||||
background: transparent; // 2. | ||||||||||
} | ||||||||||
|
||||||||||
.root[open] { | ||||||||||
display: flex; | ||||||||||
animation: fade-in theme.$animation-duration ease-out; | ||||||||||
} | ||||||||||
|
||||||||||
.root[open]::backdrop { | ||||||||||
background: theme.$backdrop-background; | ||||||||||
animation: fade-in theme.$animation-duration ease-out; | ||||||||||
bedrich-schindler marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
} | ||||||||||
|
||||||||||
.isRootSizeSmall { | ||||||||||
|
@@ -69,12 +76,8 @@ | |||||||||
max-width: min(var(--rui-local-max-width), #{map.get(theme.$sizes, auto, max-width)}); | ||||||||||
} | ||||||||||
|
||||||||||
.isRootPositionCenter { | ||||||||||
top: 50%; | ||||||||||
transform: translate(-50%, -50%); | ||||||||||
} | ||||||||||
|
||||||||||
.isRootPositionTop { | ||||||||||
position: sticky; | ||||||||||
top: var(--rui-local-outer-spacing); | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this should do the job:
Suggested change
|
||||||||||
} | ||||||||||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
@keyframes fade-in { | ||
0% { | ||
opacity: 0; | ||
} | ||
|
||
100% { | ||
opacity: 1; | ||
} | ||
} |
bedrich-schindler marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,6 @@ | ||
@use "sass:map"; | ||
@use "../../styles/settings/z-indexes"; | ||
@use "../../styles/theme/borders"; | ||
@use "../../styles/theme/typography"; | ||
|
||
$border-radius: borders.$radius-2; | ||
$z-index: z-indexes.$modal; | ||
$backdrop-z-index: z-indexes.$modal-backdrop; | ||
$title-font-size: map.get(typography.$font-size-values, 2); |
This file was deleted.
bedrich-schindler marked this conversation as resolved.
Show resolved
Hide resolved
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd expect more deletions than additions. 😞 Can we get rid of some more
featurescustom code in our focus management? Or anywhere else?