UX: Fixes navigation 1px jitter (#17467)
Context: https://meta.discourse.org/t/pixel-jump-whenever-page-refreshes-mobile-desktop/231053
We currently add 1 extra pixel when we try to restore the last scroll position on a few routes.
This is causing a bit of jumpiness, as described in the linked topic above.
<img height="300" src="ae9e69f7fd
.gif">
Notice how the content shifts by 1px while stuff loads.
I believe this 1px that we add is an artifact from the days when we used to set the header to `fixed` but I'm not sure. Either way, the header now uses `position: sticky;` so we shouldn't need that 1px adjustment.
This PR introduced no visual changes except that it fixes the jitter mentioned above.
This commit is contained in:
parent
8a3c02c985
commit
3a3628e9b0
|
@ -31,7 +31,7 @@ export default Component.extend(Scrolling, {
|
||||||
if (scrollTo >= 0) {
|
if (scrollTo >= 0) {
|
||||||
schedule("afterRender", () => {
|
schedule("afterRender", () => {
|
||||||
if (this.element && !this.isDestroying && !this.isDestroyed) {
|
if (this.element && !this.isDestroying && !this.isDestroyed) {
|
||||||
next(() => window.scrollTo(0, scrollTo + 1));
|
next(() => window.scrollTo(0, scrollTo));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ export default Component.extend(UrlRefresh, LoadMore, {
|
||||||
if (scrollTo >= 0) {
|
if (scrollTo >= 0) {
|
||||||
schedule("afterRender", () => {
|
schedule("afterRender", () => {
|
||||||
if (this.element && !this.isDestroying && !this.isDestroyed) {
|
if (this.element && !this.isDestroying && !this.isDestroyed) {
|
||||||
next(() => window.scrollTo(0, scrollTo + 1));
|
next(() => window.scrollTo(0, scrollTo));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -78,7 +78,7 @@ export default Component.extend(LoadMore, {
|
||||||
if (scrollTo >= 0) {
|
if (scrollTo >= 0) {
|
||||||
schedule("afterRender", () => {
|
schedule("afterRender", () => {
|
||||||
if (this.element && !this.isDestroying && !this.isDestroyed) {
|
if (this.element && !this.isDestroying && !this.isDestroyed) {
|
||||||
next(() => window.scrollTo(0, scrollTo + 1));
|
next(() => window.scrollTo(0, scrollTo));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,7 @@ export default Component.extend(LoadMore, {
|
||||||
if (scrollTo >= 0) {
|
if (scrollTo >= 0) {
|
||||||
schedule("afterRender", () => {
|
schedule("afterRender", () => {
|
||||||
if (this.element && !this.isDestroying && !this.isDestroyed) {
|
if (this.element && !this.isDestroying && !this.isDestroyed) {
|
||||||
next(() => window.scrollTo(0, scrollTo + 1));
|
next(() => window.scrollTo(0, scrollTo));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue