rustdoc: do not animate when user prefers reduced motion

This accessibility improvement gates the target flashing and tooltip fade-out
behind an inverted prefers-reduced-motion media query.
This commit is contained in:
zopsicle 2024-09-26 01:44:06 +02:00 committed by zopsicle
parent 0399709cdc
commit cdd3371bb4

View File

@ -1687,8 +1687,13 @@ instead, we check that it's not a "finger" cursor.
padding-right: 3px;
background-color: var(--target-background-color);
border-right: 3px solid var(--target-border-color);
}
@media not (prefers-reduced-motion) {
:target {
animation: 0.65s cubic-bezier(0, 0, 0.1, 1.0) 0.1s targetfadein;
}
}
.code-header a.tooltip {
color: inherit;
@ -1712,6 +1717,7 @@ a.tooltip:hover::after {
content: "\00a0";
}
@media not (prefers-reduced-motion) {
/* This animation is layered onto the mistake-proofing delay for dismissing
a hovered tooltip, to ensure it feels responsive even with the delay.
*/
@ -1719,6 +1725,7 @@ a.tooltip:hover::after {
opacity: 0;
transition: opacity 0.45s cubic-bezier(0, 0, 0.1, 1.0);
}
}
.popover.tooltip .content {
margin: 0.25em 0.5em;