Skip to content

Commit

Permalink
Add custom label to nav block list view appender (#47033)
Browse files Browse the repository at this point in the history
* Add ability to customise the button label

* Provide Nav block specific button label

* Use the block title within aria description

* Remove adding block label to toggle button

Co-authored-by: Ben Dwyer <[email protected]>
  • Loading branch information
getdave and Ben Dwyer authored Jan 12, 2023
1 parent fe7efd6 commit 9380c25
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { __, sprintf } from '@wordpress/i18n';
* Internal dependencies
*/
import { store as blockEditorStore } from '../../store';
import useBlockDisplayTitle from '../block-title/use-block-display-title';
import Inserter from '../inserter';

export const Appender = forwardRef(
Expand All @@ -32,14 +33,20 @@ export const Appender = forwardRef(
};
}, [] );

const blockTitle = useBlockDisplayTitle( {
clientId,
context: 'list-view',
} );

if ( hideInserter ) {
return null;
}

const descriptionId = `off-canvas-editor-appender__${ instanceId }`;
const description = sprintf(
/* translators: 1: The numerical position of the block. 2: The level of nesting for the block. */
__( 'Append at position %1$d, Level %2$d' ),
/* translators: 1: The name of the block. 2: The numerical position of the block. 3: The level of nesting for the block. */
__( 'Append to %1$s block at position %2$d, Level %3$d' ),
blockTitle,
blockCount + 1,
nestingLevel
);
Expand Down

0 comments on commit 9380c25

Please sign in to comment.