Skip to content

Commit 27019d1

Browse files
byseif21Miodec
andauthored
fix(account-history): highlight animation is not working on result selection (@byseif21) (#6744)
### Description fix the highlight animation for the account history table (when clicking a chart dot) was not visible or only worked inconsistently. This was because the animation was applied to the <tr> element, but the background color for table rows is set on the <td> elements. As a result, the animation was hidden by the static background color of the table cells. Closes # --------- Co-authored-by: Miodec <[email protected]>
1 parent dc7c94f commit 27019d1

File tree

3 files changed

+23
-19
lines changed

3 files changed

+23
-19
lines changed

frontend/src/styles/account.scss

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,13 @@
194194
table td {
195195
-webkit-appearance: unset;
196196
}
197+
198+
table tr {
199+
border-radius: var(--roundness);
200+
}
201+
197202
.active {
198-
animation: flashHighlight 4s linear 0s 1;
203+
animation: accountRowHighlight 4s linear 0s 1;
199204
}
200205

201206
.loadMoreButton {
@@ -315,7 +320,7 @@
315320
font-size: 0.75rem;
316321
}
317322

318-
tbody tr:nth-child(odd) td {
323+
tbody tr:nth-child(odd) {
319324
background: var(--sub-alt-color);
320325
}
321326

frontend/src/styles/animations.scss

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,12 @@
6464
}
6565
}
6666

67-
@keyframes flashHighlight {
67+
@keyframes accountRowHighlight {
6868
0% {
69-
background-color: var(--bg-color) !important;
70-
}
71-
10% {
72-
background-color: var(--main-color) !important;
73-
}
74-
40% {
75-
background-color: var(--main-color) !important;
69+
outline: 0.25em solid var(--main-color);
7670
}
7771
100% {
78-
background-color: var(--bg-color) !important;
72+
outline: 0.25em solid transparent;
7973
}
8074
}
8175

frontend/src/ts/pages/account.ts

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,14 +1157,19 @@ $(".pageAccount #accountHistoryChart").on("click", () => {
11571157
const windowHeight = $(window).height() ?? 0;
11581158
const offset = $(`#result-${index}`).offset()?.top ?? 0;
11591159
const scrollTo = offset - windowHeight / 2;
1160-
$([document.documentElement, document.body]).animate(
1161-
{
1162-
scrollTop: scrollTo,
1163-
},
1164-
Misc.applyReducedMotion(500)
1165-
);
1166-
$(".resultRow").removeClass("active");
1167-
$(`#result-${index}`).addClass("active");
1160+
$([document.documentElement, document.body])
1161+
.stop(true)
1162+
.animate(
1163+
{ scrollTop: scrollTo },
1164+
{
1165+
duration: Misc.applyReducedMotion(500),
1166+
done: () => {
1167+
const element = $(`#result-${index}`);
1168+
$(".resultRow").removeClass("active");
1169+
requestAnimationFrame(() => element.addClass("active"));
1170+
},
1171+
}
1172+
);
11681173
});
11691174

11701175
$(".pageAccount").on("click", ".miniResultChartButton", async (event) => {

0 commit comments

Comments
 (0)