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

mdTextareaAutosize doesn't resize textarea to a single row when mdAutosizeMinRows is set to 1 #4852

Closed
ruslan-simonenko opened this issue May 28, 2017 · 8 comments · Fixed by #4906
Assignees
Labels
needs: discussion Further discussion with the team is needed before proceeding

Comments

@ruslan-simonenko
Copy link

Bug, feature request, or proposal:

Bug

What is the expected behavior?

Textarea should be resized to a single line.

What is the current behavior?

Resize doesn't shrink textarea to a single line, stops at minimum of two lines.

What are the steps to reproduce?

http://plnkr.co/edit/0HyRxBSQI7wksb7QFLDE?p=preview

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Angular: 4.1.3
Material: v2.0.0-beta.6
OS: tested on Mac OS X 10.11.6
Browsers: tested on both Chrome 58 and Firefox 54

@devversion devversion self-assigned this May 28, 2017
@devversion
Copy link
Member

By default every textarea has the rows attribute set to 2.

This means that this is actually not an issue but maybe this should be just mentioned in the docs.

Also possible would be setting the default amount of rows to 1.

@mmalerba What do you think?

@ruslan-simonenko
Copy link
Author

ruslan-simonenko commented May 28, 2017

@devversion Just FYI in angular/material v1 there was a similar bug, and its description said that default rows must be 1 according to the spec: angular/material#2154 . Not sure whether it is still actual though - I was not able to find such information in the spec.

@devversion
Copy link
Member

devversion commented May 28, 2017

@ruslan-simonenko Thanks for linking this issue. I was not able to find it either but I just think it still makes sense to switch to 1 row by default because otherwise the mdAutosizeMinRows attribute does not work properly.

Multi-line text fields wrap text onto a new line by expanding the bottom of the field, shifting screen elements downward.

Not sure if this indicates that it should start with a single row by default.

@mmalerba
Copy link
Contributor

I think the default of 2 is just to match the native textarea's default. @jelbourn actually wrote the autosize, do you have an opinion on this Jeremy/

@devversion
Copy link
Member

@mmalerba Yeah I agree that it would be easier to follow the design of the native textarea.

I just think if it is specified (still not sure where explicitly) then it's something we need to think about more.

@jelbourn
Copy link
Member

Interesting- the spec designates "multi-line text field" and "text area" as two completely different things. On web, they're both <textarea> under the hood.

Either way, I agree that it should default to one row, otherwise you don't really have a way to do that.

devversion added a commit to devversion/material2 that referenced this issue Jun 1, 2017
* The autosize directive now sets the rows property of the textarea to one by default.
* This is necessary because browsers by default set the rows property to two and therefore setting the minRows and maxRows binding to something below two doesn't work.

Fixes angular#4852
devversion added a commit to devversion/material2 that referenced this issue Jun 1, 2017
* The autosize directive now sets the rows property of the textarea to one by default.
* This is necessary because browsers by default set the rows property to two and therefore setting the minRows and maxRows binding to something below two doesn't work.

Fixes angular#4852
devversion added a commit to devversion/material2 that referenced this issue Jun 2, 2017
* The autosize directive now sets the rows property of the textarea to one by default.
* This is necessary because browsers by default set the rows property to two and therefore setting the minRows and maxRows binding to something below two doesn't work.

Fixes angular#4852
andrewseguin pushed a commit that referenced this issue Jun 5, 2017
* The autosize directive now sets the rows property of the textarea to one by default.
* This is necessary because browsers by default set the rows property to two and therefore setting the minRows and maxRows binding to something below two doesn't work.

Fixes #4852
@rodaz
Copy link

rodaz commented Jul 11, 2017

I stiil have this bug in Firefox 54 with Material 2.0.0-beta.8.

@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 6, 2019
@mmalerba mmalerba added the needs: discussion Further discussion with the team is needed before proceeding label Mar 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs: discussion Further discussion with the team is needed before proceeding
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants