Skip to content

Commit a65e367

Browse files
authored
Rollup merge of rust-lang#129284 - notriddle:notriddle/animate-target=light, r=GuillaumeGomez
rustdoc: animate the `:target` highlight This approach is, roughly, based on how Discourse does it. It came up while discussing [some other possible sidebar changes](https://rust-lang.zulipchat.com/#narrow/stream/266220-t-rustdoc/topic/Moving.20deprecated.20items.20out.20of.20the.20way), as a design that made rapid scanning easier while avoiding the inherent trade-offs in summarizing. https://github.com/user-attachments/assets/f7a8fec3-70a5-40a1-92ea-bfdffbd61c22
2 parents c7efc95 + 9d7574f commit a65e367

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/librustdoc/html/static/css/rustdoc.css

+13
Original file line numberDiff line numberDiff line change
@@ -1547,10 +1547,23 @@ instead, we check that it's not a "finger" cursor.
15471547
margin-left: 24px;
15481548
}
15491549

1550+
@keyframes targetfadein {
1551+
from {
1552+
background-color: var(--main-background-color);
1553+
}
1554+
10% {
1555+
background-color: var(--target-border-color);
1556+
}
1557+
to {
1558+
background-color: var(--target-background-color);
1559+
}
1560+
}
1561+
15501562
:target {
15511563
padding-right: 3px;
15521564
background-color: var(--target-background-color);
15531565
border-right: 3px solid var(--target-border-color);
1566+
animation: 0.65s cubic-bezier(0, 0, 0.1, 1.0) 0.1s targetfadein;
15541567
}
15551568

15561569
.code-header a.tooltip {

tests/rustdoc-gui/target.goml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ define-function: (
1111
[theme, background, border],
1212
block {
1313
call-function: ("switch-theme", {"theme": |theme|})
14-
assert-css: ("#method\.a_method:target", {
14+
wait-for-css: ("#method\.a_method:target", {
1515
"background-color": |background|,
1616
"border-right": "3px solid " + |border|,
1717
})

0 commit comments

Comments
 (0)