-
Notifications
You must be signed in to change notification settings - Fork 3.4k
feat(textarea): textarea shrinking and resizing #7991
Conversation
@crisbeto is it auto growing/shrinkning according the content? |
It is. |
@topherfangio please take a look as well |
@crisbeto This should be noted as a breaking change in the commit message (and it should have a label). Just to confirm, this means that there is no longer a maximum size for the text area? Will this break any apps that depend on it having a maximum size? |
.on('$md.drag', onDrag) | ||
.on('$md.dragend', onDragEnd); | ||
|
||
scope.$on('$destroy', function() { |
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.
Haven't used it much; do we need to deregister the drag gesture above (i.e. undo the $mdGesture.register
?
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'd say so. I remember trying to find if there was a deregister
method, but I couldn't find one.
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.
The deregister
function will be returned from the register
call.
Yes @topherfangio, this is a breaking change. Mainly because the old behavior was: start at 1 row or fit any of the text and go until the |
@crisbeto Okay, awesome. Can you make sure to do a |
Done, hopefully it's not too picky with the placement. |
I just tested this locally and it looks pretty good, but I think there might be a small issue with the height calculation. Particularly, when you have 5 rows of text (some might be newlines), there is about Also, is it true that once a user resizes the textarea, it no longer does any automatic resizing? If so, I think that's fine, but we may want to mention this in the docs. In fact, we may want to just add a Textarea Usage section to the docs with some additional info about how users should expect it to work and what options are available. |
Regarding the height, I believe it's because 5 rows in the textarea don't necessarily translate to 5 lines of text. We use I wouldn't say it's too much of an issue in our case, because the design doesn't have a lot of padding by default. I've tried using
Otherwise I've also tried resizing the textarea purely with the
|
I managed to work around those height/padding issues. Also updated the PR to include a |
LGTM 👍 |
Just wondering if this will be merged for the next release? |
1762ce2
to
ac50ed4
Compare
…he minimum, instead of the maximum, when auto-expanding the element. * Adds a handle for vertically resizing the textarea element. * Simplifies the logic for determining the textarea height. * Makes the textarea sizing more accurate by using scrollHeight directly, instead of depending on the line height and amount of rows. * Avoids potential issues where the textarea wouldn't resize when adding a newline. * Adds the option to specify a maximum number of rows for a textarea via the `max-rows` attribute. Fixes angular#7649. Fixes angular#5919. Fixes angular#8135. BREAKING CHANGE This changes the behavior from considering the "rows" attribute as the maximum to considering it as the minimum.
max-rows
attribute.Fixes #7649.
Fixes #5919.
Fixes #8135.
BREAKING CHANGE
This changes the behavior from considering the "rows" attribute as the maximum to considering it as the minimum.
@ThomasBurleson @EladBezalel @devversion These are the textarea changes that we talked about and specced in the Google Doc.