Skip to content
New issue

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

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

Already on GitHub? # to your account

Set the value before growing the textarea on render #469

Merged

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
Collaborator

@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
Collaborator

@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 adopted-ember-addons:master Nov 2, 2016
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants