Fix focus not coming on clicking on the rename option for a sketch, inside the Sketch Modal

This commit is contained in:
nik72619c 2020-02-28 01:57:28 +05:30
parent ab7f4279bd
commit ab673fe771

View file

@ -29,6 +29,7 @@ class SketchListRowBase extends React.Component {
renameValue: props.sketch.name, renameValue: props.sketch.name,
isFocused: false isFocused: false
}; };
this.renameInput = React.createRef();
} }
onFocusComponent = () => { onFocusComponent = () => {
this.setState({ isFocused: true }); this.setState({ isFocused: true });
@ -66,7 +67,7 @@ class SketchListRowBase extends React.Component {
openRename = () => { openRename = () => {
this.setState({ this.setState({
renameOpen: true renameOpen: true
}); }, () => this.renameInput.current.focus());
} }
closeRename = () => { closeRename = () => {
@ -158,6 +159,7 @@ class SketchListRowBase extends React.Component {
onKeyUp={this.handleRenameEnter} onKeyUp={this.handleRenameEnter}
onBlur={this.resetSketchName} onBlur={this.resetSketchName}
onClick={e => e.stopPropagation()} onClick={e => e.stopPropagation()}
ref={this.renameInput}
/> />
} }
</th> </th>