Skip to content

Commit b2410d9

Browse files
[6.x] Prevent the tree structure from flashing when disclosures open (#13462)
Co-authored-by: Jason Varga <[email protected]>
1 parent c438f2e commit b2410d9

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

resources/css/components/page-tree.css

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@
77
}
88
.tree-node {
99
@apply dark:pb-0.25;
10-
transition: opacity var(--starting-style-transition-duration);
11-
transition-delay: calc(sibling-index() * var(--starting-style-sibling-delay));
12-
@starting-style {
13-
opacity: 0;
10+
/* We only want to animate tree nodes on page load. We don't want to animate child nodes when toggling them open, less it looks glitchy and feels unresponsive. */
11+
&:not(.page-tree--ready &) {
12+
transition: opacity var(--starting-style-transition-duration);
13+
transition-delay: calc(sibling-index() * var(--starting-style-sibling-delay));
14+
@starting-style {
15+
opacity: 0;
16+
}
1417
}
1518
}
1619
.page-tree-branch {

resources/js/components/structures/PageTree.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
</div>
1919
</div>
2020
</ui-panel-header>
21-
<div v-if="!loading" class="page-tree">
21+
<div v-if="!loading" class="page-tree" :class="{ 'page-tree--ready': ready }">
2222
<Draggable
2323
ref="tree"
2424
v-model="treeData"
@@ -127,6 +127,7 @@ export default {
127127
treeData: [],
128128
collapsedState: [],
129129
discardingChanges: false,
130+
ready: false,
130131
};
131132
},
132133
@@ -172,6 +173,10 @@ export default {
172173
});
173174
},
174175
176+
mounted() {
177+
setTimeout(() => this.ready = true, 500); // arbitrary delay after initial transitions
178+
},
179+
175180
methods: {
176181
isRoot(stat) {
177182
if (!this.expectsRoot) {

0 commit comments

Comments
 (0)