Skip to content

Commit

Permalink
Merge pull request #1332 from donnieberg/a11y-inlineEdit-fix
Browse files Browse the repository at this point in the history
Change inline edit for a11y, eslint updates
  • Loading branch information
interactivellama committed May 1, 2018
2 parents b7e2215 + 4c67a47 commit 854bde7
Show file tree
Hide file tree
Showing 3 changed files with 244 additions and 151 deletions.
16 changes: 13 additions & 3 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,6 +116,13 @@ class InlineEdit extends React.Component {
}
}

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

endEditMode = (option) => {
if (this.willSave) {
clearTimeout(this.willSave);
Expand Down Expand Up @@ -212,15 +220,18 @@ 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 +240,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
Loading

0 comments on commit 854bde7

Please sign in to comment.