From 69913361b78ce0abdfbc005d03d7779e21d5a2fa Mon Sep 17 00:00:00 2001 From: Gary Pendergast Date: Tue, 27 Mar 2018 14:50:15 +1100 Subject: [PATCH] After the permalink is saved, focus on the new permalink. --- editor/components/post-permalink/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/editor/components/post-permalink/index.js b/editor/components/post-permalink/index.js index c647121716a3e..c168eb3e66c94 100644 --- a/editor/components/post-permalink/index.js +++ b/editor/components/post-permalink/index.js @@ -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;