From dc40184eb8458926845882a89424c18b3949a223 Mon Sep 17 00:00:00 2001 From: Mayank Tripathi <70465598+Mayank-Tripathi32@users.noreply.github.com> Date: Tue, 11 Feb 2025 23:56:50 +0530 Subject: [PATCH] Writing Flow: restore early return for no block selection in tab nav hook (#69079) Co-authored-by: Mayank-Tripathi32 Co-authored-by: stokesman Co-authored-by: t-hamano Co-authored-by: singhakanshu00 Co-authored-by: Mamaduka --- .../block-editor/src/components/writing-flow/use-tab-nav.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/block-editor/src/components/writing-flow/use-tab-nav.js b/packages/block-editor/src/components/writing-flow/use-tab-nav.js index 46c40d56fe96d9..7f06cfe651db3e 100644 --- a/packages/block-editor/src/components/writing-flow/use-tab-nav.js +++ b/packages/block-editor/src/components/writing-flow/use-tab-nav.js @@ -125,6 +125,10 @@ export default function useTabNav() { return; } + if ( ! hasMultiSelection() && ! getSelectedBlockClientId() ) { + return; + } + const isShift = event.shiftKey; const direction = isShift ? 'findPrevious' : 'findNext'; const nextTabbable = focus.tabbable[ direction ]( event.target );