Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set the value before growing the textarea on render #469

Merged
merged 1 commit into from
Nov 2, 2016

Conversation

Kerrick
Copy link
Contributor

@Kerrick Kerrick commented Aug 20, 2016

This fixes an issue with auto-grow when rendering a textarea that already had a value passed in (without user input).

@miguelcobain
Copy link
Owner

@shoxter I think you had this problem as well. Can you confirm this fixes it? It should.
Thanks a lot @Kerrick.

@jamesdixon
Copy link

@miguelcobain I just ran into this issue as well and can confirm that @Kerrick's fix works as advertised.

@miguelcobain
Copy link
Owner

@jamesdixon
Copy link

@miguelcobain sort of, but not completely.

Note that this is for a text area that already has a value. If you go to the demo page and enter some text that spans multiple lines in the text area, navigate to another route and then come back, you'll notice there is a significant delay in the text area growing to accommodate the text. I am able to reproduce this locally as well.

However, if the code is modified to move this.growTextArea() to after the value is set, the delay is gone.

  didRender() {
    this._super(...arguments);
    // setValue below ensures that the input value is the same as this.value
    this.setValue(this.get('value'));
    this.growTextarea();
  },

@shoxter
Copy link
Contributor

shoxter commented Oct 20, 2016

@miguelcobain It's been a while since I tested this.

I think @ibarrick did a fix on the branch of ember-paper we're actually running on for production.

If I remember correctly, my problem was similar to that of @jamesdixon

Let me know if you need anything further.

@Ericky14
Copy link

Ericky14 commented Nov 2, 2016

When is this PR getting merged? This fix works. Without this, textareas with a preset value do not grow when the page is loaded, some input is necessary.

@miguelcobain miguelcobain merged commit 535ff6b into miguelcobain:master Nov 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants