Skip to content

Commit

Permalink
After the permalink is saved, focus on the new permalink.
Browse files Browse the repository at this point in the history
  • Loading branch information
pento committed Mar 27, 2018
1 parent 74b5ad8 commit 6991336
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions editor/components/post-permalink/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ class PostPermalink extends Component {
};
}

componentDidUpdate( prevProps, prevState ) {
// If we've just stopped editing the permalink, focus on the new permalink.
if ( prevState.editingPermalink && ! this.state.editingPermalink ) {
const permalinkButton = document.querySelector( '.editor-post-permalink__link' );
if ( permalinkButton ) {
permalinkButton.focus();
}
}
}

render() {
const { isNew, previewLink, isEditable, samplePermalink } = this.props;
const { iconClass, editingPermalink } = this.state;
Expand Down

0 comments on commit 6991336

Please sign in to comment.