FIX: Upwards scrolling occasionally broken
This fixes a bug in Chrome where upwards scrolling would occasionally not work properly.
This commit is contained in:
parent
afcf149c34
commit
8bca2647ea
|
@ -192,7 +192,14 @@ export default MountWidget.extend({
|
||||||
// Quickly going back might mean the element is destroyed
|
// Quickly going back might mean the element is destroyed
|
||||||
const position = $refreshedElem.position();
|
const position = $refreshedElem.position();
|
||||||
if (position && position.top) {
|
if (position && position.top) {
|
||||||
$("html, body").scrollTop(position.top + distToElement);
|
let whereY = position.top + distToElement;
|
||||||
|
$("html, body").scrollTop(whereY);
|
||||||
|
|
||||||
|
// This seems weird, but somewhat infrequently a rerender
|
||||||
|
// will cause the browser to scroll to the top of the document
|
||||||
|
// in Chrome. This makes sure the scroll works correctly if that
|
||||||
|
// happens.
|
||||||
|
Ember.run.next(() => $("html, body").scrollTop(whereY));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue