Textarea height misbehaviour when max-height applied
| Project: | Auto Growing Textareas |
| Version: | 1.2.2 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | dbz1982 |
| Status: | active |
There is a small issue when you pre-populate a textarea with content. If the height of the pre-populated field is more than the max-height, the textarea will revert to the original size of the textarea.
This problem can be overcome easily by editing the following section:
if (this.dummy.html() != html) {
this.dummy.html(html);
if (this.max_height > 0 && (this.dummy.height() + this.line_height > this.max_height)){
this.textarea.css('overflow-y', 'auto');
this.textarea.css('height', this.max_height);
//Added the above line to enfore the max height if content length more than max height.
} else {
this.textarea.css('overflow-y', 'hidden');
if (this.textarea.height() < this.dummy.height() + this.line_height || (this.dummy.height() < this.textarea.height())) {
this.textarea.animate({height: (this.dummy.height() + this.line_height) + 'px'}, 100);}
}
}
I noticed this in Firefox 3 on Ubuntu Linux OS. The issue and fix is still to be confirmed in other browsers.
