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

Bugfix/command centre accessibility issue #51521

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.
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 @@ -12,7 +12,6 @@ import {
Button,
VisuallyHidden,
__experimentalText as Text,
__experimentalHStack as HStack,
} from '@wordpress/components';
import { BlockIcon } from '@wordpress/block-editor';
import { store as commandsStore } from '@wordpress/commands';
Expand Down Expand Up @@ -144,6 +143,12 @@ function BaseDocumentActions( { className, icon, children, onBack } ) {
<div
className={ classnames( 'edit-site-document-actions', className ) }
>
<VisuallyHidden
as="h1"
className="edit-site-document-actions__title"
>
{ children }
</VisuallyHidden>
{ onBack && (
<Button
className="edit-site-document-actions__back"
Expand All @@ -160,16 +165,8 @@ function BaseDocumentActions( { className, icon, children, onBack } ) {
className="edit-site-document-actions__command"
onClick={ () => openCommandCenter() }
>
<HStack
className="edit-site-document-actions__title"
spacing={ 1 }
justify="center"
>
<BlockIcon icon={ icon } />
<Text size="body" as="h1">
{ children }
</Text>
</HStack>
<BlockIcon icon={ icon } />
<Text as="span">{ __( 'Command center' ) }</Text>
<span className="edit-site-document-actions__shortcut">
{ displayShortcut.primary( 'k' ) }
</span>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,44 +1,25 @@
.edit-site-document-actions {
display: grid;
grid-template-columns: 1fr 2fr 1fr;
height: $button-size;
// Flex items will, by default, refuse to shrink below a minimum
// intrinsic width. In order to shrink this flexbox item, and
// subsequently truncate child text, we set an explicit min-width.
// See https://dev.w3.org/csswg/css-flexbox/#min-size-auto
min-width: 0;
background: $gray-100;
align-items: center;
display: flex;
justify-items: center;
}

.edit-site-document-actions__command {
align-items: center;
background-color: $gray-100;
border-radius: 4px;
display: flex;
height: auto;
justify-content: space-between;
width: min(100%, 450px);
overflow: hidden;

&:hover {
color: currentColor;
background: $gray-200;
> span + span {
padding-left: clamp(0.25rem, 0.5rem, 1rem);
}
}

.edit-site-document-actions__command {
grid-column: 1 / -1;
display: grid;
grid-template-columns: 1fr 2fr 1fr;
grid-row: 1;
}


.edit-site-document-actions__title {
flex-grow: 1;
color: var(--wp-block-synced-color);
overflow: hidden;
grid-column: 2 / 3;

h1 {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
color: var(--wp-block-synced-color);
}

.edit-site-document-actions.is-page & {
color: $gray-800;

Expand Down