Skip to content

Commit

Permalink
Adjust UI for Block Variation Picker labels
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Q authored and gziolo committed Mar 12, 2020
1 parent 944a6ef commit 66bc158
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,14 @@ function BlockVariationPicker( {
iconSize={ 48 }
onClick={ () => onSelect( variation ) }
className="block-editor-block-variation-picker__variation"
label={ variation.description || variation.title }
/>
<span
className="block-editor-block-variation-picker__variation-label"
role="presentation"
>
{ variation.title }
</Button>
</span>
</li>
) ) }
</ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,23 @@
margin: $grid-unit-10 $grid-unit-10 0 0;
flex-shrink: 1;
max-width: 100px;

button {
display: flex;
}
}

.block-editor-block-variation-picker__variation {
padding: $grid-unit-10;
}

.block-editor-block-variation-picker__variation-label {
font-family: $default-font;
font-size: 12px;
display: block;
margin-right: $grid-unit-15;
text-align: center;
}
}

.block-editor-block-variation-picker__variation {
Expand Down
15 changes: 10 additions & 5 deletions packages/block-library/src/columns/variations.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import { __ } from '@wordpress/i18n';
const variations = [
{
name: 'two-columns-equal',
title: __( 'Two columns; equal split' ),
title: __( '50 / 50' ),
description: __( 'Two columns; equal split' ),
icon: (
<SVG
width="48"
Expand All @@ -35,7 +36,8 @@ const variations = [
},
{
name: 'two-columns-one-third-two-thirds',
title: __( 'Two columns; one-third, two-thirds split' ),
title: __( '30 / 70' ),
description: __( 'Two columns; one-third, two-thirds split' ),
icon: (
<SVG
width="48"
Expand All @@ -58,7 +60,8 @@ const variations = [
},
{
name: 'two-columns-two-thirds-one-third',
title: __( 'Two columns; two-thirds, one-third split' ),
title: __( '70 / 30' ),
description: __( 'Two columns; two-thirds, one-third split' ),
icon: (
<SVG
width="48"
Expand All @@ -81,7 +84,8 @@ const variations = [
},
{
name: 'three-columns-equal',
title: __( 'Three columns; equal split' ),
title: __( '33 / 33 / 33' ),
description: __( 'Three columns; equal split' ),
icon: (
<SVG
width="48"
Expand All @@ -104,7 +108,8 @@ const variations = [
},
{
name: 'three-columns-wider-center',
title: __( 'Three columns; wide center column' ),
title: __( '25 / 50 / 25' ),
description: __( 'Three columns; wide center column' ),
icon: (
<SVG
width="48"
Expand Down
2 changes: 1 addition & 1 deletion packages/e2e-tests/specs/editor/blocks/columns.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe( 'Columns', () => {

it( 'restricts all blocks inside the columns block', async () => {
await insertBlock( 'Columns' );
await page.click( 'button[text()="Two columns; equal split"]' );
await page.click( '[aria-label="Two columns; equal split"]' );
await page.click( '[aria-label="Block navigation"]' );
const columnBlockMenuItem = (
await page.$x(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe( 'Navigating the block hierarchy', () => {

it( 'should navigate using the block hierarchy dropdown menu', async () => {
await insertBlock( 'Columns' );
await page.click( 'button[text()="Two columns; equal split"]' );
await page.click( '[aria-label="Two columns; equal split"]' );

// Add a paragraph in the first column.
await page.keyboard.press( 'Tab' ); // Tab to inserter.
Expand Down Expand Up @@ -73,7 +73,7 @@ describe( 'Navigating the block hierarchy', () => {

it( 'should navigate block hierarchy using only the keyboard', async () => {
await insertBlock( 'Columns' );
await page.click( 'button[text()="Two columns; equal split"]' );
await page.click( '[aria-label="Two columns; equal split"]' );

// Add a paragraph in the first column.
await page.keyboard.press( 'Tab' ); // Tab to inserter.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe( 'Writing Flow', () => {
await page.keyboard.press( 'Enter' );
await page.keyboard.type( '/columns' );
await page.keyboard.press( 'Enter' );
await page.click( ':focus button[text()="Two columns; equal split"]' );
await page.click( ':focus [aria-label="Two columns; equal split"]' );
await page.click( ':focus .block-editor-button-block-appender' );
await page.waitForSelector( ':focus.block-editor-inserter__search' );
await page.keyboard.type( 'Paragraph' );
Expand Down

0 comments on commit 66bc158

Please sign in to comment.