From 5cdc3d247b08f02a346a6ba055ecf9336c7d8165 Mon Sep 17 00:00:00 2001 From: Brent Swisher Date: Mon, 14 Oct 2019 18:43:49 -0400 Subject: [PATCH] Update writing flow to disable navigation mode for new posts so that the first tab from the title starts editing the content --- .../block-editor/src/components/writing-flow/index.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/block-editor/src/components/writing-flow/index.js b/packages/block-editor/src/components/writing-flow/index.js index 37e45dd2680d0..88e06a50a3265 100644 --- a/packages/block-editor/src/components/writing-flow/index.js +++ b/packages/block-editor/src/components/writing-flow/index.js @@ -386,7 +386,11 @@ class WritingFlow extends Component { } render() { - const { children } = this.props; + const { children, isCleanNewPost } = this.props; + + if ( isCleanNewPost ) { + this.disableNavigationMode(); + } // Disable reason: Wrapper itself is non-interactive, but must capture // bubbling events from children to determine focus transition intents. @@ -415,6 +419,8 @@ class WritingFlow extends Component { export default compose( [ withSelect( ( select ) => { + const { isCleanNewPost } = select( 'core/editor' ); + const { getSelectedBlockClientId, getMultiSelectedBlocksStartClientId, @@ -431,8 +437,8 @@ export default compose( [ const selectedBlockClientId = getSelectedBlockClientId(); const selectionStartClientId = getMultiSelectedBlocksStartClientId(); const selectionEndClientId = getMultiSelectedBlocksEndClientId(); - return { + isCleanNewPost: isCleanNewPost(), selectedBlockClientId, selectionStartClientId, selectionBeforeEndClientId: getPreviousBlockClientId( selectionEndClientId || selectedBlockClientId ),