Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change inline edit for a11y, eslint updates #1332

Merged
merged 4 commits into from
May 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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