-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
src/cdk/text-field/autosize.ts
Outdated
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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
6341079
to
be82d57
Compare
This comment has been minimized.
This comment has been minimized.
1 similar comment
Hi @jelbourn! This PR has merge conflicts due to recent upstream merges. |
be82d57
to
d9c4d14
Compare
This comment has been minimized.
This comment has been minimized.
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Fixes #13163