swarm-ui: menus, popovers, toasts and dialogs fade in, with one motion guard
Dialogs, toasts, popovers, dropdowns and the filter popover appeared with no transition, and the header menu had a keyframe of its own. theme.css holds --enter and --fade, off under reduced motion and the motion setting's reduce, and each floating box uses them.
This commit is contained in:
parent
fdeb95a61b
commit
9fdde2ec63
4 changed files with 135 additions and 25 deletions
|
|
@ -17,6 +17,7 @@
|
|||
display: inline-block;
|
||||
}
|
||||
.ui-dropdown {
|
||||
animation: var(--enter);
|
||||
position: absolute;
|
||||
top: calc(100% + 0.25em);
|
||||
left: 0;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,10 @@
|
|||
border-radius: var(--radius-md);
|
||||
background: var(--bg-elev);
|
||||
box-shadow: var(--shadow-pop);
|
||||
animation: header-menu-enter 140ms ease;
|
||||
/* Mount-triggered, not a state transition: the popover only exists in the DOM
|
||||
while open, so a keyframe on entry is the right tool. `--enter` is the
|
||||
shared one, with its motion guard (`theme.css`). */
|
||||
animation: var(--enter);
|
||||
}
|
||||
/* A long list, such as the firing alerts: wide, and it scrolls. */
|
||||
.header-menu-wide {
|
||||
|
|
@ -28,29 +31,6 @@
|
|||
max-height: 70vh;
|
||||
overflow-y: auto;
|
||||
}
|
||||
/* Mount-triggered, not a state transition: the popover only exists in the DOM
|
||||
while open, so a keyframe on entry is the right tool. */
|
||||
@keyframes header-menu-enter {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(-0.25em) scale(0.98);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: none;
|
||||
}
|
||||
}
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.header-menu-popover {
|
||||
animation: none;
|
||||
}
|
||||
}
|
||||
:root[data-motion="reduce"] .header-menu-popover {
|
||||
animation: none;
|
||||
}
|
||||
:root[data-motion="allow"] .header-menu-popover {
|
||||
animation: header-menu-enter 140ms ease;
|
||||
}
|
||||
/* A row that is a link or a button. */
|
||||
.header-menu-item {
|
||||
display: flex;
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@
|
|||
creates a new `.jg-node` DOM node when its `key` (the node id) is
|
||||
genuinely new, so this only plays once per node, the first time it
|
||||
appears in a fetched snapshot. Same shape as Shell.css's
|
||||
`shell-page-enter` / the header menu's `header-menu-enter` —
|
||||
`shell-page-enter` / the shared `--enter` in `theme.css` —
|
||||
see either for the three-rule motion-guard this mirrors. */
|
||||
.jg-node {
|
||||
margin: 0;
|
||||
|
|
|
|||
|
|
@ -109,3 +109,46 @@
|
|||
var(--purple-dim)
|
||||
);
|
||||
}
|
||||
|
||||
/* Entrance motion. A floating box (a menu, a popover, a toast, a dialog) fades
|
||||
in and drops a few pixels into place as it opens, and a dialog's backdrop
|
||||
fades in. `--enter` and `--fade` are whole `animation` values, so a rule
|
||||
writes `animation: var(--enter)` and the motion guard lives here once: off
|
||||
under `prefers-reduced-motion` and the motion setting's "reduce", back on
|
||||
for "allow". */
|
||||
:root {
|
||||
--enter: ui-enter 0.14s ease-out;
|
||||
--fade: ui-fade 0.14s ease-out;
|
||||
}
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
:root {
|
||||
--enter: none;
|
||||
--fade: none;
|
||||
}
|
||||
}
|
||||
:root[data-motion="reduce"] {
|
||||
--enter: none;
|
||||
--fade: none;
|
||||
}
|
||||
:root[data-motion="allow"] {
|
||||
--enter: ui-enter 0.14s ease-out;
|
||||
--fade: ui-fade 0.14s ease-out;
|
||||
}
|
||||
@keyframes ui-enter {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(-4px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: none;
|
||||
}
|
||||
}
|
||||
@keyframes ui-fade {
|
||||
from {
|
||||
opacity: 0;
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue