Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: WordPress/gutenberg
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: bef38d9e6c9899d9d2d6d585ffd2b7d20e06382b
Choose a base ref
..
head repository: WordPress/gutenberg
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 3f014c89787f4c8eaac72f81fb5e0d079fdead00
Choose a head ref
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ import { useRefEffect } from '@wordpress/compose';
/**
* Internal dependencies
*/
import { getBlockClientId } from '../../utils/dom';
import { getBlockClientId, isInSameBlock } from '../../utils/dom';
import { store as blockEditorStore } from '../../store';

/**
@@ -101,6 +101,16 @@ export function getClosestTabbable(
}

function isTabCandidate( node ) {
// Skip if there's only one child that is content editable (and thus a
// better candidate).
if (
node.children.length === 1 &&
isInSameBlock( node, node.firstElementChild ) &&
node.firstElementChild.getAttribute( 'contenteditable' ) === 'true'
) {
return;
}

// Not a candidate if the node is not tabbable.
if ( ! focus.tabbable.isTabbableIndex( node ) ) {
return false;
1 change: 1 addition & 0 deletions packages/block-library/src/list-item/edit.js
Original file line number Diff line number Diff line change
@@ -65,6 +65,7 @@ export default function ListItemEdit( {
const blockProps = useBlockProps( { ref: useCopy( clientId ) } );
const innerBlocksProps = useInnerBlocksProps( blockProps, {
allowedBlocks: [ 'core/list' ],
renderAppender: false,
} );
const useEnterRef = useEnter( { content, clientId } );
const useSpaceRef = useSpace( clientId );
Original file line number Diff line number Diff line change
@@ -2,15 +2,11 @@
* WordPress dependencies
*/
import { SVG, Rect } from '@wordpress/primitives';
import { Icon, menu, moreVertical, moreHorizontal } from '@wordpress/icons';
import { Icon, menu } from '@wordpress/icons';

export default function OverlayMenuIcon( { icon } ) {
if ( icon === 'menu' ) {
return <Icon icon={ menu } />;
} else if ( icon === 'more-vertical' ) {
return <Icon icon={ moreVertical } />;
} else if ( icon === 'more-horizontal' ) {
return <Icon icon={ moreHorizontal } />;
}

return (
10 changes: 0 additions & 10 deletions packages/block-library/src/navigation/edit/overlay-menu-preview.js
Original file line number Diff line number Diff line change
@@ -41,16 +41,6 @@ export default function OverlayMenuPreview( { setAttributes, hasIcon, icon } ) {
aria-label={ __( 'menu' ) }
label={ <OverlayMenuIcon icon="menu" /> }
/>
<ToggleGroupControlOption
value="more-vertical"
aria-label={ __( 'more vertical' ) }
label={ <OverlayMenuIcon icon="more-vertical" /> }
/>
<ToggleGroupControlOption
value="more-horizontal"
aria-label={ __( 'more horizontal' ) }
label={ <OverlayMenuIcon icon="more-horizontal" /> }
/>
</ToggleGroupControl>
</>
);
4 changes: 0 additions & 4 deletions packages/block-library/src/navigation/index.php
Original file line number Diff line number Diff line change
@@ -623,10 +623,6 @@ function render_block_core_navigation( $attributes, $content, $block ) {
if ( isset( $attributes['icon'] ) ) {
if ( 'menu' === $attributes['icon'] ) {
$toggle_button_icon = '<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5 5v1.5h14V5H5zm0 7.8h14v-1.5H5v1.5zM5 19h14v-1.5H5V19z" /></svg>';
} elseif ( 'more-vertical' === $attributes['icon'] ) {
$toggle_button_icon = '<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z" /></svg>';
} elseif ( 'more-horizontal' === $attributes['icon'] ) {
$toggle_button_icon = '<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11 13h2v-2h-2v2zm-6 0h2v-2H5v2zm12-2v2h2v-2h-2z" /></svg>';
}
}
$toggle_button_content = $should_display_icon_label ? $toggle_button_icon : __( 'Menu' );
Original file line number Diff line number Diff line change
@@ -77,7 +77,6 @@ describe( 'Allowed Blocks Setting on InnerBlocks', () => {
await insertButton.click();
// Select the list wrapper so the image is inserable.
await page.keyboard.press( 'ArrowUp' );
await page.keyboard.press( 'ArrowUp' );
await insertBlock( 'Image' );
await closeGlobalBlockInserter();
await page.waitForSelector( '.product[data-number-of-children="2"]' );
Original file line number Diff line number Diff line change
@@ -19,7 +19,6 @@ describe( 'Block Switcher', () => {
await insertBlock( 'List' );
await page.keyboard.type( 'List content' );
await page.keyboard.press( 'ArrowUp' );
await page.keyboard.press( 'ArrowUp' );
await pressKeyWithModifier( 'alt', 'F10' );

// Verify the block switcher exists.
@@ -47,7 +46,6 @@ describe( 'Block Switcher', () => {
await insertBlock( 'List' );
await page.keyboard.type( 'List content' );
await page.keyboard.press( 'ArrowUp' );
await page.keyboard.press( 'ArrowUp' );
await pressKeyWithModifier( 'alt', 'F10' );

// Verify the block switcher exists.
@@ -81,7 +79,6 @@ describe( 'Block Switcher', () => {
await insertBlock( 'List' );
await page.keyboard.type( 'List content' );
await page.keyboard.press( 'ArrowUp' );
await page.keyboard.press( 'ArrowUp' );
await pressKeyWithModifier( 'alt', 'F10' );

// Verify the block switcher exists.
@@ -96,7 +93,6 @@ describe( 'Block Switcher', () => {
await insertBlock( 'List' );
await page.keyboard.type( 'List content' );
await page.keyboard.press( 'ArrowUp' );
await page.keyboard.press( 'ArrowUp' );
await insertBlock( 'Heading' );
await page.keyboard.type( 'I am a header' );
await page.keyboard.down( 'Shift' );
@@ -110,7 +106,6 @@ describe( 'Block Switcher', () => {
await insertBlock( 'List' );
await page.keyboard.type( 'List content' );
await page.keyboard.press( 'ArrowUp' );
await page.keyboard.press( 'ArrowUp' );
await insertBlock( 'Heading' );
await page.keyboard.type( 'I am a header' );
await page.keyboard.press( 'Enter' );
Original file line number Diff line number Diff line change
@@ -235,7 +235,7 @@ describe( 'splitting and merging blocks', () => {
await page.keyboard.type( 'item 1' );
await page.keyboard.press( 'Enter' );
await page.keyboard.type( 'item 2' );
await pressKeyTimes( 'ArrowUp', 5 );
await pressKeyTimes( 'ArrowUp', 3 );
await page.keyboard.press( 'Delete' );
// Carret should be in the first block and at the proper position.
await page.keyboard.type( '-' );
@@ -257,7 +257,6 @@ describe( 'splitting and merging blocks', () => {
await page.keyboard.press( 'Enter' );
await page.keyboard.type( 'item 2' );
await page.keyboard.press( 'ArrowUp' );
await page.keyboard.press( 'ArrowUp' );
await pressKeyTimes( 'ArrowLeft', 6 );
await page.keyboard.press( 'Backspace' );
// Carret should be in the first block and at the proper position.
11 changes: 4 additions & 7 deletions test/e2e/specs/editor/blocks/list.spec.js
Original file line number Diff line number Diff line change
@@ -333,7 +333,7 @@ test.describe( 'List', () => {
await page.keyboard.press( 'Enter' );
await editor.clickBlockToolbarButton( 'Indent' );
await page.keyboard.type( 'two' );
await pageUtils.pressKeyTimes( 'ArrowUp', 5 );
await pageUtils.pressKeyTimes( 'ArrowUp', 4 );
await editor.transformBlockTo( 'core/paragraph' );

await expect.poll( editor.getEditedPostContent ).toBe(
@@ -419,7 +419,6 @@ test.describe( 'List', () => {
await page.keyboard.press( 'Enter' );
await page.keyboard.type( 'two' );
await page.keyboard.press( 'ArrowUp' );
await page.keyboard.press( 'ArrowUp' );
await page.keyboard.press( 'Enter' );

await expect.poll( editor.getEditedPostContent ).toBe(
@@ -493,7 +492,6 @@ test.describe( 'List', () => {
await page.keyboard.press( 'Enter' );
await page.keyboard.type( 'two' );
await page.keyboard.press( 'ArrowUp' );
await page.keyboard.press( 'ArrowUp' );
await page.keyboard.press( 'Enter' );
await page.keyboard.press( 'Enter' );

@@ -682,7 +680,7 @@ test.describe( 'List', () => {

// To do: investigate why the toolbar is not showing up right after
// outdenting.
await page.keyboard.press( 'ArrowUp' );
await page.keyboard.press( 'ArrowLeft' );
await editor.clickBlockToolbarButton( 'Outdent' );

await expect.poll( editor.getEditedPostContent ).toBe(
@@ -782,7 +780,6 @@ test.describe( 'List', () => {
await page.keyboard.press( 'Enter' );
await page.keyboard.type( 'c' );
await page.keyboard.press( 'ArrowUp' );
await page.keyboard.press( 'ArrowUp' );
await pageUtils.pressKeyWithModifier( 'shift', 'Enter' );

await expect.poll( editor.getEditedPostContent ).toBe(
@@ -924,7 +921,7 @@ test.describe( 'List', () => {
await page.keyboard.type( '* 1' );
await page.keyboard.press( 'Enter' );
await page.keyboard.type( ' a' );
await pageUtils.pressKeyTimes( 'ArrowUp', 3 );
await pageUtils.pressKeyTimes( 'ArrowUp', 2 );
await page.keyboard.press( 'Enter' );
// The caret should land in the second item.
await page.keyboard.type( '2' );
@@ -1025,6 +1022,7 @@ test.describe( 'List', () => {

// Again create a new paragraph.
await page.keyboard.press( 'Enter' );
await page.keyboard.press( 'Enter' );

// Move to the end of the list.
await page.keyboard.press( 'ArrowLeft' );
@@ -1058,7 +1056,6 @@ test.describe( 'List', () => {
await page.keyboard.press( 'Enter' );
await page.keyboard.type( '2' );
await page.keyboard.press( 'ArrowUp' );
await page.keyboard.press( 'ArrowUp' );
await page.keyboard.press( 'Backspace' );
await page.keyboard.press( 'Backspace' );