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

breaking(TextArea): remove autoHeight prop #3465

Merged
merged 1 commit into from
Feb 27, 2019

Conversation

layershifter
Copy link
Member

Fixes #3418.

BREAKING CHANGES

This PR removes the autoHeight prop from the TextArea component.

Motivation

We had numerous issues with TextArea component and autoHeight prop:

I had a conversation with team from Ukraine that continuously uses SUIR and they said that autoHeight is buggy and they are using react-textarea-autosize, too 😼

So, as @levithomason originally proposed I will suggest to use react-textarea-autosize:

I would encourage users to use that module if it suits their needs. SUI requires no special classNames nor markup to style the textarea when used in a Form, so it will work OOTB.

Before

import { Form, TextArea } from 'semantic-ui-react'

//

<Form.TextArea autoHeight />
<TextArea autoHeight />

After

import { Form, TextArea } from 'semantic-ui-react'
import TextareaAutosize from 'react-textarea-autosize'

//

<Form.TextArea control={TextareaAutosize} />
<TextareaAutosize  />

I also created a Codesandbox example with how-tos, https://codesandbox.io/s/1v67906ll4. It will be available on the Prototypes page after the next release, but you can start to migrate right now.

@codecov-io
Copy link

Codecov Report

Merging #3465 into master will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3465      +/-   ##
==========================================
- Coverage   99.89%   99.89%   -0.01%     
==========================================
  Files         172      172              
  Lines        2814     2796      -18     
==========================================
- Hits         2811     2793      -18     
  Misses          3        3
Impacted Files Coverage Δ
src/addons/TextArea/TextArea.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0ecbe28...1fc5e46. Read the comment docs.

1 similar comment
@codecov-io
Copy link

Codecov Report

Merging #3465 into master will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3465      +/-   ##
==========================================
- Coverage   99.89%   99.89%   -0.01%     
==========================================
  Files         172      172              
  Lines        2814     2796      -18     
==========================================
- Hits         2811     2793      -18     
  Misses          3        3
Impacted Files Coverage Δ
src/addons/TextArea/TextArea.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0ecbe28...1fc5e46. Read the comment docs.

@layershifter layershifter merged commit abba96b into master Feb 27, 2019
@layershifter layershifter deleted the breaking/textarea-remove-autoheight branch February 27, 2019 16:23
@levithomason
Copy link
Member

Released in [email protected].

@TristanPouliquen
Copy link

@layershifter Hi, I'm trying to migrate to your new implementation with TextAreaAutosize to work with forms in a Semantic Accordion.

However, I can't seem to get the textarea value in the onChange function. I looked at your Sandbox and I also get undefined when I log data.valuein your example (how the value is kept in memory I do not know as you also do value={this.state.value} and the value is also undefined in the state I get from my console.log.

Do you have any idea as to why ? Thanks in advance !

@layershifter
Copy link
Member Author

However, I can't seem to get the textarea value in the onChange function.

You should use:

onChange={e => this.setState({ value: e.target.value })}

I've update CodeSandbox to reflect this 👍

@TristanPouliquen
Copy link

Thanks for your swift answer ! It works as a charm 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants