mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
FIX: Quirky scrolling position with keyboard use
This commit is contained in:
parent
0af4d7cc20
commit
c2c4eff08b
1 changed files with 16 additions and 0 deletions
|
@ -59,7 +59,23 @@ export default Ember.Component.extend({
|
|||
|
||||
newTree._emberView = this;
|
||||
const patches = diff(this._tree || this._rootNode, newTree);
|
||||
|
||||
const $body = $(document);
|
||||
const prevHeight = $body.height();
|
||||
const prevScrollTop = $body.scrollTop();
|
||||
|
||||
this._rootNode = patch(this._rootNode, patches);
|
||||
|
||||
const height = $body.height();
|
||||
const scrollTop = $body.scrollTop();
|
||||
|
||||
// This hack is for when swapping out many cloaked views at once
|
||||
// when using keyboard navigation. It could suddenly move the
|
||||
// scroll
|
||||
if (prevHeight === height && scrollTop !== prevScrollTop) {
|
||||
$body.scrollTop(prevScrollTop);
|
||||
}
|
||||
|
||||
this._tree = newTree;
|
||||
|
||||
if (this._afterRender) {
|
||||
|
|
Loading…
Reference in a new issue