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

Add more contextual information for screen readers in the explorer menu #5386

12 changes: 2 additions & 10 deletions client/src/components/Explorer/ExplorerItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@ const childrenIcon = (
<Icon name="folder-inverse" />
);

const editIcon = (
<Icon name="edit" title={STRINGS.EDIT} />
);

const nextIcon = (
<Icon name="arrow-right" title={STRINGS.SEE_CHILDREN} />
);

/**
* One menu item in the page explorer, with different available actions
* and information depending on the metadata of the page.
Expand Down Expand Up @@ -47,15 +39,15 @@ const ExplorerItem = ({ item, onClick }) => {
href={`${ADMIN_URLS.PAGES}${id}/edit/`}
className="c-explorer__item__action c-explorer__item__action--small"
>
{editIcon}
<Icon name="edit" title={STRINGS.EDIT_PAGE.replace('{title}', title)} />
</Button>
{hasChildren ? (
<Button
className="c-explorer__item__action"
onClick={onClick}
href={`${ADMIN_URLS.PAGES}${id}/`}
>
{nextIcon}
<Icon name="arrow-right" title={STRINGS.VIEW_CHILD_PAGES_OF_PAGE.replace('{title}', title)} />
</Button>
) : null}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ exports[`ExplorerItem children 1`] = `
<Icon
className={null}
name="edit"
title="Edit"
title="Edit 'test'"
/>
</Button>
<Button
Expand All @@ -54,7 +54,7 @@ exports[`ExplorerItem children 1`] = `
<Icon
className={null}
name="arrow-right"
title="See children"
title="View child pages of 'test'"
/>
</Button>
</div>
Expand Down Expand Up @@ -93,7 +93,7 @@ exports[`ExplorerItem renders 1`] = `
<Icon
className={null}
name="edit"
title="Edit"
title="Edit 'test'"
/>
</Button>
</div>
Expand Down Expand Up @@ -150,7 +150,7 @@ exports[`ExplorerItem should show a publication status if not live 1`] = `
<Icon
className={null}
name="edit"
title="Edit"
title="Edit 'test'"
/>
</Button>
<Button
Expand All @@ -166,7 +166,7 @@ exports[`ExplorerItem should show a publication status if not live 1`] = `
<Icon
className={null}
name="arrow-right"
title="See children"
title="View child pages of 'test'"
/>
</Button>
</div>
Expand Down Expand Up @@ -223,7 +223,7 @@ exports[`ExplorerItem should show a publication status with unpublished changes
<Icon
className={null}
name="edit"
title="Edit"
title="Edit 'test'"
/>
</Button>
<Button
Expand All @@ -239,7 +239,7 @@ exports[`ExplorerItem should show a publication status with unpublished changes
<Icon
className={null}
name="arrow-right"
title="See children"
title="View child pages of 'test'"
/>
</Button>
</div>
Expand Down
4 changes: 2 additions & 2 deletions client/tests/stubs.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,12 @@ global.wagtailConfig = {
SHORT_DATE_FORMAT: 'DD/MM/YYYY',
},
STRINGS: {
EDIT: 'Edit',
DELETE: 'Delete',
PAGE: 'Page',
PAGES: 'Pages',
LOADING: 'Loading…',
NO_RESULTS: 'No results',
SERVER_ERROR: 'Server Error',
SEE_CHILDREN: 'See children',
SEE_ALL: 'See all',
CLOSE_EXPLORER: 'Close explorer',
ALT_TEXT: 'Alt text',
Expand All @@ -44,6 +42,8 @@ global.wagtailConfig = {
BROKEN_LINK: 'Broken link',
MISSING_DOCUMENT: 'Missing document',
CLOSE: 'Close',
EDIT_PAGE: 'Edit \'{title}\'',
VIEW_CHILD_PAGES_OF_PAGE: 'View child pages of \'{title}\'',
},
};

Expand Down
4 changes: 2 additions & 2 deletions wagtail/admin/templates/wagtailadmin/admin_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,12 @@
};

wagtailConfig.STRINGS = {
EDIT: "{% trans 'Edit' %}",
DELETE: "{% trans 'Delete' %}",
PAGE: "{% trans 'Page' %}",
PAGES: "{% trans 'Pages' %}",
LOADING: "{% trans 'Loading…' %}",
NO_RESULTS: "{% trans 'No results' %}",
SERVER_ERROR: "{% trans 'Server Error' %}",
SEE_CHILDREN: "{% trans 'See children' %}",
SEE_ALL: "{% trans 'See all' %}",
CLOSE_EXPLORER: "{% trans 'Close explorer' %}",
ALT_TEXT: "{% trans 'Alt text' %}",
Expand All @@ -52,6 +50,8 @@
BROKEN_LINK: "{% trans 'Broken link' %}",
MISSING_DOCUMENT: "{% trans 'Missing document' %}",
CLOSE: "{% trans 'Close' %}",
EDIT_PAGE: "{% trans 'Edit \'{title}\'' %}",
VIEW_CHILD_PAGES_OF_PAGE: "{% trans 'View child pages of \'{title}\'' %}",

MONTHS: [
"{% trans 'January' %}",
Expand Down