You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A multiLine textfield (EnhancedTextarea) moves the cursor to the end of the field when a setState is called. Specifically, if you're working in the middle of a large block of text and you make a change which results in the height of the textarea changing, the cursor will move to the end of the field.
If I comment out the setState call in syncHeightWithShadow the problem disappears. I'm sure this function is needed...not sure why it's losing cursor position.
key: 'syncHeightWithShadow',
value: function syncHeightWithShadow(newValue, event) {
var shadow = this.refs.shadow;
if (newValue !== undefined) {
shadow.value = newValue;
}
var newHeight = shadow.scrollHeight;
if (this.props.rowsMax >= this.props.rows) {
newHeight = Math.min(this.props.rowsMax * rowsHeight, newHeight);
}
newHeight = Math.max(newHeight, rowsHeight);
if (this.state.height !== newHeight) {
/*this.setState({
height: newHeight
});*/
if (this.props.onHeightChange) {
this.props.onHeightChange(event, newHeight);
}
}
}
I'm using version 0.15.0-beta.2. I did not test on 0.15.0, but I looked through the changes to this file and I didn't see anything related.
Tested in Chrome and Firefox
The text was updated successfully, but these errors were encountered:
oephrosinin
added a commit
to oephrosinin/material-ui
that referenced
this issue
May 24, 2016
oliviertassinari
changed the title
multiLine TextField loses cursor position on height change
[TextField] multiLine TextField loses cursor position on height change
Dec 18, 2016
A multiLine textfield (EnhancedTextarea) moves the cursor to the end of the field when a setState is called. Specifically, if you're working in the middle of a large block of text and you make a change which results in the height of the textarea changing, the cursor will move to the end of the field.
If I comment out the
setState
call insyncHeightWithShadow
the problem disappears. I'm sure this function is needed...not sure why it's losing cursor position.I'm using version 0.15.0-beta.2. I did not test on 0.15.0, but I looked through the changes to this file and I didn't see anything related.
Tested in Chrome and Firefox
The text was updated successfully, but these errors were encountered: