Skip to content

Commit a804198

Browse files
authored
Remove unused FilterNavigatorBar animations (#5591)
[Production](https://profiler.firefox.com/public/etegz8k5g139b8q7n74qfqv6z4ztb0nzvy051k0/calltree/?globalTrackOrder=0&thread=0&transforms=ff-8&v=11) | [Deploy preview](https://deploy-preview-5591--perf-html.netlify.app/public/etegz8k5g139b8q7n74qfqv6z4ztb0nzvy051k0/calltree/?globalTrackOrder=0&thread=0&transforms=ff-8&v=11) On the production branch I don't see any animations in the breadcrumb bar where the time range filters are displayed, when I make a selection, commit a selection or "pop" selections. No animations in the call tree transform list either. Since nobody has noticed, let's just remove the code for them, because this gets rid of some of the uses of react-transition-group, which is one of our barriers to upgrading React (#5590).
2 parents 998bd9c + 2a83c47 commit a804198

File tree

3 files changed

+23
-95
lines changed

3 files changed

+23
-95
lines changed

src/components/shared/FilterNavigatorBar.css

Lines changed: 3 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
cursor: default;
2121
user-select: none;
2222

23-
/* Note: no overflow: hidden so that we can see the exit animation for ranges */
23+
/* Note: no overflow: hidden for historical reasons - we wanted to see
24+
an animation for items at the end while they were fading out, but
25+
we have removed this animation in the meantime */
2426
}
2527

2628
.filterNavigatorBarItem {
@@ -40,9 +42,6 @@
4042
in the forced colors media query. */
4143
forced-color-adjust: none;
4244
line-height: 24px;
43-
transition:
44-
opacity 250ms var(--animation-curve),
45-
transform 250ms var(--animation-curve);
4645
}
4746

4847
.filterNavigatorBarRootItem {
@@ -98,23 +97,12 @@
9897
}
9998

10099
.filterNavigatorBarItem:not(.filterNavigatorBarLeafItem)::after {
101-
animation: fadeIn 250ms var(--animation-curve);
102100
background-image: var(--internal-separator-img);
103101
background-position: -18px -12px;
104102
background-repeat: no-repeat;
105103
background-size: 24px 24px;
106104
}
107105

108-
@keyframes fadeIn {
109-
from {
110-
opacity: 0;
111-
}
112-
113-
to {
114-
opacity: 1;
115-
}
116-
}
117-
118106
.filterNavigatorBarItem:not(
119107
.filterNavigatorBarRootItem,
120108
.filterNavigatorBarLeafItem
@@ -163,46 +151,6 @@
163151
opacity: 0.65;
164152
}
165153

166-
/* Animation */
167-
168-
.filterNavigatorBarUncommittedTransition-exit {
169-
/* Because of the underlying transition library, this element is still here
170-
* while the new "committed" element is created, which pushes it further
171-
* right. By using display: none here, we prevent this bad effect. */
172-
display: none;
173-
}
174-
175-
.filterNavigatorBarTransition-enter {
176-
color: inherit;
177-
178-
/* We use the same value as the uncommitted item.
179-
* Note that the "uncommitted item" won't have this "enter" class when
180-
* committing, because of how we insert it (it's not part of the same loop). */
181-
opacity: 0.65;
182-
}
183-
184-
.filterNavigatorBarTransition-enter.filterNavigatorBarTransition-enter-active {
185-
color: var(--internal-selected-color);
186-
opacity: 1;
187-
}
188-
189-
.filterNavigatorBarTransition-exit {
190-
opacity: 1;
191-
}
192-
193-
.filterNavigatorBarTransition-exit.filterNavigatorBarTransition-exit-active {
194-
opacity: 0;
195-
transform: translateX(50%);
196-
}
197-
198-
/* Do not animate the filter navigator bar items when user prefers reduced motion */
199-
@media (prefers-reduced-motion) {
200-
.filterNavigatorBarItem {
201-
animation: none;
202-
transition: none;
203-
}
204-
}
205-
206154
@media (forced-colors: active) {
207155
.filterNavigatorBar {
208156
--internal-background-color: ButtonFace;

src/components/shared/FilterNavigatorBar.tsx

Lines changed: 17 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
import * as React from 'react';
66
import classNames from 'classnames';
7-
import { CSSTransition, TransitionGroup } from 'react-transition-group';
87
import './FilterNavigatorBar.css';
98

109
type FilterNavigatorBarListItemProps = {
@@ -71,31 +70,21 @@ export class FilterNavigatorBar extends React.PureComponent<Props> {
7170
const { className, items, selectedItem, uncommittedItem, onPop } =
7271
this.props;
7372

74-
const transitions = items.map((item, i) => (
75-
<CSSTransition
76-
key={i}
77-
classNames="filterNavigatorBarTransition"
78-
timeout={250}
79-
>
80-
<FilterNavigatorBarListItem
81-
index={i}
82-
onClick={i === items.length - 1 && !uncommittedItem ? null : onPop}
83-
isFirstItem={i === 0}
84-
isLastItem={i === items.length - 1}
85-
isSelectedItem={i === selectedItem}
86-
>
87-
{item}
88-
</FilterNavigatorBarListItem>
89-
</CSSTransition>
90-
));
91-
92-
if (uncommittedItem) {
93-
transitions.push(
94-
<CSSTransition
95-
key={items.length}
96-
classNames="filterNavigatorBarUncommittedTransition"
97-
timeout={0}
98-
>
73+
return (
74+
<ol className={classNames('filterNavigatorBar', className)}>
75+
{items.map((item, i) => (
76+
<FilterNavigatorBarListItem
77+
key={i}
78+
index={i}
79+
onClick={i === items.length - 1 && !uncommittedItem ? null : onPop}
80+
isFirstItem={i === 0}
81+
isLastItem={i === items.length - 1}
82+
isSelectedItem={i === selectedItem}
83+
>
84+
{item}
85+
</FilterNavigatorBarListItem>
86+
))}
87+
{uncommittedItem ? (
9988
<FilterNavigatorBarListItem
10089
index={items.length}
10190
isFirstItem={false}
@@ -106,17 +95,8 @@ export class FilterNavigatorBar extends React.PureComponent<Props> {
10695
>
10796
{uncommittedItem}
10897
</FilterNavigatorBarListItem>
109-
</CSSTransition>
110-
);
111-
}
112-
113-
return (
114-
<TransitionGroup
115-
component="ol"
116-
className={classNames('filterNavigatorBar', className)}
117-
>
118-
{transitions}
119-
</TransitionGroup>
98+
) : null}
99+
</ol>
120100
);
121101
}
122102
}

src/test/components/__snapshots__/FilterNavigatorBar.test.tsx.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ exports[`app/ProfileFilterNavigator renders ProfileFilterNavigator properly 2`]
4040
</button>
4141
</li>
4242
<li
43-
class="filterNavigatorBarItem filterNavigatorBarSelectedItem filterNavigatorBarLeafItem filterNavigatorBarTransition-enter filterNavigatorBarTransition-enter-active"
43+
class="filterNavigatorBarItem filterNavigatorBarSelectedItem filterNavigatorBarLeafItem"
4444
>
4545
<span
4646
class="filterNavigatorBarItemContent"
@@ -70,7 +70,7 @@ exports[`app/ProfileFilterNavigator renders ProfileFilterNavigator properly 3`]
7070
</button>
7171
</li>
7272
<li
73-
class="filterNavigatorBarItem filterNavigatorBarSelectedItem filterNavigatorBarLeafItem filterNavigatorBarTransition-enter filterNavigatorBarTransition-enter-active"
73+
class="filterNavigatorBarItem filterNavigatorBarSelectedItem filterNavigatorBarLeafItem"
7474
>
7575
<button
7676
class="filterNavigatorBarItemContent"
@@ -80,7 +80,7 @@ exports[`app/ProfileFilterNavigator renders ProfileFilterNavigator properly 3`]
8080
</button>
8181
</li>
8282
<li
83-
class="filterNavigatorBarItem filterNavigatorBarUncommittedItem filterNavigatorBarLeafItem filterNavigatorBarUncommittedTransition-enter filterNavigatorBarUncommittedTransition-enter-active"
83+
class="filterNavigatorBarItem filterNavigatorBarUncommittedItem filterNavigatorBarLeafItem"
8484
title="100μs"
8585
>
8686
<span

0 commit comments

Comments
 (0)