You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you need to scroll to the top of an area that generates a vertical scroll bar, you can specify the id of an element
77
79
of the scrollable area. Default is `window` for using the scroll position of the whole viewport. You can pass an options
78
80
object in your application's `config/environment.js` file.
@@ -93,15 +95,31 @@ ENV['routerScroll'] = {
93
95
};
94
96
```
95
97
96
-
Moreover, if your route breaks up render into multiple phases, you may need to delay scrollTop functionality until after
97
-
the First Meaningful Paint using `delayScrollTop: true` in your config. `delayScrollTop` defaults to `false`.
98
+
#### Scroll Timing
99
+
100
+
You may want the default "out of the box" behaviour. We schedule scroll after Ember's `render`. This occurs on the tightest schedule between route transition start and end
101
+
102
+
However, you have other options. You may need to delay scroll functionality until after
103
+
the First Meaningful Paint using `scrollWhenPainted: true` in your config. `scrollWhenPainted` defaults to `false`.
104
+
105
+
Then next two config properties uses [`ember-app-scheduler`](https://github.com/ember-app-scheduler/ember-app-scheduler), so be sure to follow the instructions in the README. We include the `setupRouter` and `reset`. This all happens after `routeDidChange`.
106
+
107
+
```javascript
108
+
ENV['routerScroll'] = {
109
+
scrollWhenPainted:true
110
+
};
111
+
```
112
+
113
+
Also, if you need to perform the logic when the route is idle or if your route breaks up render into multiple phases, add `delayScrollTop: true` in your config. `delayScrollTop` defaults to `false`. This will be renamed to `scrollWhenIdle` in a major release.
98
114
99
115
```javascript
100
116
ENV['routerScroll'] = {
101
117
delayScrollTop:true
102
118
};
103
119
```
104
120
121
+
I would suggest trying all of them out and seeing which works best for your app!
0 commit comments