Skip to content

fix(text-field): autosize textarea not resizing on minRows decrease #13437

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

Merged
merged 1 commit into from
Oct 19, 2018

Conversation

jelbourn
Copy link
Member

@jelbourn jelbourn commented Oct 5, 2018

Fixes #13163

@jelbourn jelbourn added the target: patch This PR is targeted for the next patch release label Oct 5, 2018
@jelbourn jelbourn requested a review from mmalerba October 5, 2018 00:38
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Oct 5, 2018
Copy link
Member

@crisbeto crisbeto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

private _textareaElement: HTMLTextAreaElement;

/** Minimum amount of rows in the textarea. */
@Input('cdkAutosizeMinRows')
get minRows(): number { return this._minRows; }
set minRows(value: number) {
if (value !== this._minRows) {
this._minRowsChanged = true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be able to reduce this to this._minRowsChanged = value !== this._minRows. It's unlikely for this to be called quickly enough as to have the _minRowsChanged be overwritten before we've had a chance to resize.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think even better is to keep track of the number at the last resize rather than a boolean. That way if they change it to something new and then back to the original we can skip the work (I don't know if this will ever come up in real situations, but technically more correct)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@crisbeto crisbeto added pr: lgtm action: merge The PR is ready for merge by the caretaker labels Oct 5, 2018
@jelbourn jelbourn force-pushed the autosize-minmax-live branch from 6341079 to be82d57 Compare October 5, 2018 18:02
@ngbot

This comment has been minimized.

1 similar comment
@ngbot
Copy link

ngbot bot commented Oct 11, 2018

Hi @jelbourn! This PR has merge conflicts due to recent upstream merges.
Please help to unblock it by resolving these conflicts. Thanks!

@jelbourn jelbourn force-pushed the autosize-minmax-live branch from be82d57 to d9c4d14 Compare October 11, 2018 17:10
@ngbot

This comment has been minimized.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Changes min rows on a textarea inside a MatFormField is not reflected in a runtime.
5 participants