Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Textarea: Save and restore scrollTop during autogrow height update

Thanks go to Kangsik Kim <allsteady@gmail.com> for the idea to set scrollTop

Fixes gh-6898
  • Loading branch information...
commit a85aa3a8c0ef28373caeec86dcf53661d9eb123a 1 parent a91747c
@gabrielschulhof gabrielschulhof authored
Showing with 11 additions and 8 deletions.
  1. +11 −8 js/widgets/forms/autogrow.js
View
19 js/widgets/forms/autogrow.js
@@ -93,7 +93,9 @@ define( [
},
_updateHeight: function() {
-
+ var paddingTop, paddingBottom, paddingHeight, scrollHeight, clientHeight,
+ borderTop, borderBottom, borderHeight, height,
+ scrollTop = this.window.scrollTop();
this.keyupTimeout = 0;
// IE8 textareas have the onpage property - others do not
@@ -105,13 +107,12 @@ define( [
});
}
- var paddingTop, paddingBottom, paddingHeight,
- scrollHeight = this.element[ 0 ].scrollHeight,
- clientHeight = this.element[ 0 ].clientHeight,
- borderTop = parseFloat( this.element.css( "border-top-width" ) ),
- borderBottom = parseFloat( this.element.css( "border-bottom-width" ) ),
- borderHeight = borderTop + borderBottom,
- height = scrollHeight + borderHeight + 15;
+ scrollHeight = this.element[ 0 ].scrollHeight;
+ clientHeight = this.element[ 0 ].clientHeight;
+ borderTop = parseFloat( this.element.css( "border-top-width" ) );
+ borderBottom = parseFloat( this.element.css( "border-bottom-width" ) );
+ borderHeight = borderTop + borderBottom;
+ height = scrollHeight + borderHeight + 15;
// Issue 6179: Padding is not included in scrollHeight and
// clientHeight by Firefox if no scrollbar is visible. Because
@@ -132,6 +133,8 @@ define( [
"min-height": "",
"max-height": ""
});
+
+ this.window.scrollTop( scrollTop );
},
refresh: function() {
Please sign in to comment.
Something went wrong with that request. Please try again.