Skip to content

Commit

Permalink
wip add some better screenreader hints
Browse files Browse the repository at this point in the history
  • Loading branch information
gwwar committed Oct 6, 2021
1 parent 541cfb4 commit 8fd170c
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions packages/block-editor/src/components/list-view/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
useState,
forwardRef,
} from '@wordpress/element';
import { __ } from '@wordpress/i18n';
import { __, sprintf } from '@wordpress/i18n';

const WINDOW_OVERSCAN = 1;
const ITEM_HEIGHT = 36;
Expand Down Expand Up @@ -239,6 +239,17 @@ function ListView(
]
);

const ariaLabel = __experimentalPersistentListViewFeatures
? sprintf(
/* translators: %1$d: rendered items in the persistent list view %2$d: total number of blocks in the persistent list view*/
__(
'Block navigation structure. Displaying %1$d blocks of %2$d total blocks. Press keydown to view more.'
),
windowMeasurement.maxVisible,
visibleBlockCount
)
: __( 'Block navigation structure.' );

return (
<AsyncModeProvider value={ true }>
<ListViewDropIndicator
Expand All @@ -247,7 +258,7 @@ function ListView(
/>
<TreeGrid
className="block-editor-list-view-tree"
aria-label={ __( 'Block navigation structure' ) }
aria-label={ ariaLabel }
ref={ treeGridRef }
onCollapseRow={ collapseRow }
onExpandRow={ expandRow }
Expand Down

0 comments on commit 8fd170c

Please sign in to comment.