Skip to content

Commit

Permalink
Change inline edit to be able to Tab from inline edit to 'x' button. …
Browse files Browse the repository at this point in the history
…When 'x' is focused, Tab agin blurs the field
  • Loading branch information
donnieberg committed Apr 20, 2018
1 parent 2b9941c commit 4f70dd5
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions components/forms/input/inline.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ const defaultProps = {
class InlineEdit extends React.Component {
constructor (props) {
super(props);

this.state = {
isEditing: false,
value: null,
Expand All @@ -115,7 +116,14 @@ class InlineEdit extends React.Component {
}
}

endEditMode = (option) => {
handleCloseBtnClick = () => {
this.endEditMode()
setTimeout(() => {
this.editButtonRef.focus()
}, 100)
}

endEditMode = () => {
if (this.willSave) {
clearTimeout(this.willSave);
delete this.willSave;
Expand Down Expand Up @@ -212,15 +220,16 @@ class InlineEdit extends React.Component {
category="utility"
name="close"
position="right"
onClick={this.endEditMode}
tabIndex="-1"
onBlur={this.handleBlur}
onClick={this.handleCloseBtnClick}
/>
) : null
}
disabled={disabled}
inlineEditTrigger={
<Button
assistiveText={assistiveText}
buttonRef={(component) => { if(component) this.editButtonRef = component }}
className="slds-m-left_x-small"
disabled={disabled}
iconName="edit"
Expand All @@ -229,7 +238,6 @@ class InlineEdit extends React.Component {
variant="icon"
/>
}
onBlur={this.handleBlur}
onChange={this.handleChange}
onClick={!this.state.isEditing ? this.triggerEditMode : null}
onKeyDown={this.handleKeyDown}
Expand Down

0 comments on commit 4f70dd5

Please sign in to comment.