@@ -46,6 +46,7 @@ import type {
4646 IVariableModel ,
4747 IVariableState ,
4848} from './interfaces/i_variable_model.js' ;
49+ import { Msg } from './msg.js' ;
4950import * as registry from './registry.js' ;
5051import * as Tooltip from './tooltip.js' ;
5152import * as arrayUtils from './utils/array.js' ;
@@ -1567,15 +1568,27 @@ export class Block {
15671568 }
15681569
15691570 /**
1570- * @returns The custom string to use as the role description for this block,
1571- * or undefined if no custom description is set.
1571+ * @returns The string to use as the role description for this block. If a
1572+ * custom provider has been set, use that. Otherwise, return a default
1573+ * description based on the block's properties.
15721574 */
1573- getAriaRoleDescription ( ) : string | undefined {
1574- if ( ! this . ariaRoleDescriptionProvider ) return undefined ;
1575- if ( typeof this . ariaRoleDescriptionProvider === 'function' ) {
1576- return this . ariaRoleDescriptionProvider ( ) ;
1575+ getAriaRoleDescription ( ) : string {
1576+ if ( this . ariaRoleDescriptionProvider ) {
1577+ if ( typeof this . ariaRoleDescriptionProvider === 'function' ) {
1578+ return this . ariaRoleDescriptionProvider ( ) ;
1579+ }
1580+ return replaceMessageReferences ( this . ariaRoleDescriptionProvider ) ;
1581+ }
1582+
1583+ let roleDescription : string ;
1584+ if ( this . statementInputCount ) {
1585+ roleDescription = Msg [ 'BLOCK_LABEL_CONTAINER' ] ;
1586+ } else if ( this . outputConnection ) {
1587+ roleDescription = Msg [ 'BLOCK_LABEL_VALUE' ] ;
1588+ } else {
1589+ roleDescription = Msg [ 'BLOCK_LABEL_STATEMENT' ] ;
15771590 }
1578- return replaceMessageReferences ( this . ariaRoleDescriptionProvider ) ;
1591+ return roleDescription ;
15791592 }
15801593
15811594 /**
0 commit comments