Skip to content

Textarea does not auto resize its height when created #733

Closed
@derMart

Description

@derMart

As title, create a Textarea with :autoResize=true and its model to contain some large text.
The Textarea will only adjust its height after the contents of the textarea dom element is changed by the user (so that its scrollheight is affected, e.g. by entering a newline)

Initially, this.cachedScrollHeight is falsy, so that it will be set to this.$el.scrollHeight by

this.cachedScrollHeight = this.$el.scrollHeight;

Then, the code block following:
if (this.cachedScrollHeight !== this.$el.scrollHeight) {

won't be executed, which results in the height of $el not being set to the scrollHeight.

The fix for this issue is simple, just remove:

this.cachedScrollHeight = this.$el.scrollHeight;

That way, the height of $el will be adjusted, as this.cachedScrollHeight !== this.$el.scrollHeight

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type: BugIssue contains a bug related to a specific component. Something about the component is not working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions