Skip to content

Commit

Permalink
doc(input): add note about handleChange implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonSelg committed Aug 4, 2016
1 parent 6f03fb5 commit f29e570
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion components/input/Input.js
Expand Up @@ -82,7 +82,9 @@ const factory = (FontIcon) => {
const { onChange, multiline, maxLength } = this.props;
const valueFromEvent = event.target.value;

// trim value to maxLength if that exists (only on multiline inputs)
// Trim value to maxLength if that exists (only on multiline inputs).
// Note that this is still required even tho we have the onKeyPress filter
// because the user could paste smt in the textarea.
const haveToTrim = (multiline && maxLength && event.target.value.length > maxLength);
const value = haveToTrim ? valueFromEvent.substr(0, maxLength) : valueFromEvent;

Expand Down

0 comments on commit f29e570

Please sign in to comment.