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

Accessibility: Fixed reading order of keyboard shortcuts. #15631

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,28 @@ const mapKeyCombination = ( keyCombination ) => keyCombination.map( ( character,
} );

const ShortcutList = ( { shortcuts } ) => (
<dl className="edit-post-keyboard-shortcut-help__shortcut-list">
/*
* Disable reason: The `list` ARIA role is redundant but
* Safari+VoiceOver won't announce the list otherwise.
*/
/* eslint-disable jsx-a11y/no-redundant-roles */
<ul className="edit-post-keyboard-shortcut-help__shortcut-list" role="list">
{ shortcuts.map( ( { keyCombination, description, ariaLabel }, index ) => (
<div
<li
className="edit-post-keyboard-shortcut-help__shortcut"
key={ index }
>
<dt className="edit-post-keyboard-shortcut-help__shortcut-term">
<div className="edit-post-keyboard-shortcut-help__shortcut-description">
{ description }
</div>
<div className="edit-post-keyboard-shortcut-help__shortcut-term">
<kbd className="edit-post-keyboard-shortcut-help__shortcut-key-combination" aria-label={ ariaLabel }>
{ mapKeyCombination( castArray( keyCombination ) ) }
</kbd>
</dt>
<dd className="edit-post-keyboard-shortcut-help__shortcut-description">
{ description }
</dd>
</div>
</div>
</li>
) ) }
</dl>
</ul>
);

const ShortcutSection = ( { title, shortcuts } ) => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,20 @@
align-items: center;
padding: 0.6rem 0;
border-top: 1px solid $light-gray-500;
margin-bottom: 0;

&:last-child {
border-bottom: 1px solid $light-gray-500;
}
}

&__shortcut-term {
order: 1;
font-weight: 600;
margin: 0 0 0 1rem;
}

&__shortcut-description {
flex: 1;
order: 0;
margin: 0;

// IE 11 flex item fix - ensure the item does not collapse
Expand Down