Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve accessibility of the templates list Actions column #42555

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 19 additions & 4 deletions packages/edit-site/src/components/list/actions/index.js
Expand Up @@ -4,8 +4,13 @@
import { useDispatch } from '@wordpress/data';
import { store as coreStore } from '@wordpress/core-data';
import { __ } from '@wordpress/i18n';
import { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';
import { moreVertical } from '@wordpress/icons';
import {
DropdownMenu,
MenuGroup,
MenuItem,
VisuallyHidden,
} from '@wordpress/components';
import { Icon, moreVertical, reset } from '@wordpress/icons';
import { store as noticesStore } from '@wordpress/notices';

/**
Expand All @@ -26,7 +31,14 @@ export default function Actions( { template } ) {
const isRevertable = isTemplateRevertable( template );

if ( ! isRemovable && ! isRevertable ) {
return null;
return (
<>
<Icon icon={ reset } />
<VisuallyHidden>
{ __( 'No actions available' ) }
</VisuallyHidden>
</>
);
}

async function revertAndSaveTemplate() {
Expand Down Expand Up @@ -54,8 +66,11 @@ export default function Actions( { template } ) {
return (
<DropdownMenu
icon={ moreVertical }
label={ __( 'Actions' ) }
className="edit-site-list-table__actions"
text={ __( 'Actions' ) }
toggleProps={ {
variant: 'tertiary',
} }
>
{ ( { onClose } ) => (
<MenuGroup>
Expand Down
35 changes: 17 additions & 18 deletions packages/edit-site/src/components/list/style.scss
Expand Up @@ -63,25 +63,25 @@
max-width: 960px;

tr {
display: flex;
align-items: center;
padding: $grid-unit-20;
box-sizing: border-box;
border-top: $border-width solid $gray-100;
margin: 0;

&:first-child {
border-top: 0;
th,
td {
border-top: $border-width solid $gray-100;
padding: $grid-unit-20;
@include break-medium() {
padding: $grid-unit-30 $grid-unit-40;
}
}

@include break-medium() {
padding: $grid-unit-30 $grid-unit-40;
&:first-child {
th,
td {
border-top: 0;
}
}

// Template.
.edit-site-list-table-column:nth-child(1) {
width: calc(60% - 18px);
padding-right: $grid-unit-30;
width: 58%;

a {
display: inline-block;
Expand All @@ -93,14 +93,13 @@

// Added by.
.edit-site-list-table-column:nth-child(2) {
width: calc(40% - 18px);
width: 30%;
word-break: break-word;
}

// Actions.
.edit-site-list-table-column:nth-child(3) {
min-width: $button-size;
flex-shrink: 0;
width: 12%;
}
}

Expand All @@ -109,10 +108,10 @@
font-weight: 600;
text-align: left;
color: $gray-900;
border-top: none;
border-bottom: $border-width solid $gray-300;

th {
border-top: 0;
border-bottom: $border-width solid $gray-300;
font-weight: inherit;
}
}
Expand Down
7 changes: 2 additions & 5 deletions packages/edit-site/src/components/list/table.js
Expand Up @@ -4,10 +4,7 @@
import { useSelect } from '@wordpress/data';
import { store as coreStore, useEntityRecords } from '@wordpress/core-data';
import { __, sprintf } from '@wordpress/i18n';
import {
VisuallyHidden,
__experimentalHeading as Heading,
} from '@wordpress/components';
import { __experimentalHeading as Heading } from '@wordpress/components';
import { decodeEntities } from '@wordpress/html-entities';

/**
Expand Down Expand Up @@ -85,7 +82,7 @@ export default function Table( { templateType } ) {
className="edit-site-list-table-column"
role="columnheader"
>
<VisuallyHidden>{ __( 'Actions' ) }</VisuallyHidden>
{ __( 'Manage' ) }
</th>
</tr>
</thead>
Expand Down