diff --git a/packages/block-editor/src/components/block-list/block.native.js b/packages/block-editor/src/components/block-list/block.native.js index 2c4516db06017..c342025678b6d 100644 --- a/packages/block-editor/src/components/block-list/block.native.js +++ b/packages/block-editor/src/components/block-list/block.native.js @@ -162,7 +162,6 @@ function BlockListBlock( { blockType, draggingClientId, draggingEnabled, - firstToSelectId, isDescendantOfParentSelected, isDescendentBlockSelected, isParentSelected, @@ -174,7 +173,6 @@ function BlockListBlock( { getBlockHierarchyRootClientId, getBlockIndex, getBlockParents, - getLowestCommonAncestorWithSelectedBlock, getSelectedBlockClientId, getSettings, hasSelectedInnerBlock, @@ -198,13 +196,6 @@ function BlockListBlock( { selectedParents.includes( rootClientId ); const hasInnerBlocks = getBlockCount( clientId ) > 0; - const commonAncestor = - getLowestCommonAncestorWithSelectedBlock( clientId ); - const commonAncestorIndex = parents.indexOf( commonAncestor ) - 1; - const firstBlockToSelectId = commonAncestor - ? parents[ commonAncestorIndex ] - : parents[ parents.length - 1 ]; - // For blocks with inner blocks, we only enable the dragging in the nested // blocks if any of them are selected. This way we prevent the long-press // gesture from being disabled for elements within the block UI. @@ -223,7 +214,6 @@ function BlockListBlock( { blockType: currentBlockType, draggingClientId: currentDraggingClientId, draggingEnabled: isDraggingEnabled, - firstToSelectId: firstBlockToSelectId, isDescendantOfParentSelected: descendantOfParentSelected, isDescendentBlockSelected: descendentBlockSelected, isParentSelected: parentSelected, @@ -245,11 +235,10 @@ function BlockListBlock( { [ clientId, removeBlock ] ); const onFocus = useCallback( () => { - const blockId = firstToSelectId ?? clientId; if ( ! isSelected ) { - selectBlock( blockId ); + selectBlock( clientId ); } - }, [ selectBlock, clientId, firstToSelectId, isSelected ] ); + }, [ selectBlock, clientId, isSelected ] ); const onLayout = useCallback( ( { nativeEvent } ) => { diff --git a/packages/react-native-editor/CHANGELOG.md b/packages/react-native-editor/CHANGELOG.md index 6c98c6a5b8a35..eebc693a26b01 100644 --- a/packages/react-native-editor/CHANGELOG.md +++ b/packages/react-native-editor/CHANGELOG.md @@ -10,10 +10,11 @@ For each user feature we should also add a importance categorization label to i --> ## Unreleased +- [**] Tapping on all nested blocks gets focus directly instead of having to tap multiple times depeding on the nesting levels. [#50672] ## 1.95.0 - [*] Fix crash when trying to convert to regular blocks an undefined/deleted reusable block [#50475] -- [**] Tapping on a nested block now gets focus directly instead of having to tap multiple times depeding on the nesting levels. [#50108] +- [**] Tapping on nested text blocks gets focus directly instead of having to tap multiple times depeding on the nesting levels. [#50108] - [*] Use host app namespace in reusable block message [#50478] ## 1.94.0 diff --git a/packages/react-native-editor/__device-tests__/pages/editor-page.js b/packages/react-native-editor/__device-tests__/pages/editor-page.js index 4c0b7249a8e77..defc7bf277c93 100644 --- a/packages/react-native-editor/__device-tests__/pages/editor-page.js +++ b/packages/react-native-editor/__device-tests__/pages/editor-page.js @@ -499,6 +499,19 @@ class EditorPage { await toolBarButton.click(); } + async navigateUp() { + let navigateUpElements = []; + do { + await this.driver.sleep( 2000 ); + navigateUpElements = await this.driver.elementsByAccessibilityId( + 'Navigate Up' + ); + if ( navigateUpElements.length > 0 ) { + await navigateUpElements[ 0 ].click(); + } + } while ( navigateUpElements.length > 0 ); + } + // ========================= // Inline toolbar functions // =========================