Skip to content

Commit

Permalink
Fix Template preview menu item accessibility. (#57456)
Browse files Browse the repository at this point in the history
  • Loading branch information
afercia committed Dec 30, 2023
1 parent 9431114 commit 63a6321
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion packages/editor/src/components/post-template/block-theme.js
Expand Up @@ -90,7 +90,8 @@ export default function BlockThemeControl( { id } ) {
<MenuGroup>
<MenuItem
icon={ ! isTemplateHidden ? check : undefined }
isPressed={ ! isTemplateHidden }
isSelected={ ! isTemplateHidden }
role="menuitemcheckbox"
onClick={ () => {
setRenderingMode(
isTemplateHidden
Expand Down
8 changes: 4 additions & 4 deletions test/e2e/specs/site-editor/pages.spec.js
Expand Up @@ -196,15 +196,15 @@ test.describe( 'Pages', () => {
await templateOptionsButton.click();
const templatePreviewButton = page
.getByRole( 'menu', { name: 'Template options' } )
.getByRole( 'menuitem', { name: 'Template preview' } );
.getByRole( 'menuitemcheckbox', { name: 'Template preview' } );

await expect( templatePreviewButton ).toHaveAttribute(
'aria-pressed',
'aria-checked',
'true'
);
await templatePreviewButton.click();
await expect( templatePreviewButton ).toHaveAttribute(
'aria-pressed',
'aria-checked',
'false'
);

Expand All @@ -229,7 +229,7 @@ test.describe( 'Pages', () => {
await templateOptionsButton.click();
await templatePreviewButton.click();
await expect( templatePreviewButton ).toHaveAttribute(
'aria-pressed',
'aria-checked',
'true'
);

Expand Down

0 comments on commit 63a6321

Please sign in to comment.