File tree Expand file tree Collapse file tree 1 file changed +11
-8
lines changed
Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -224,9 +224,6 @@ export class BlockSvg
224224 this . currentConnectionCandidate = null ;
225225
226226 this . doInit_ ( ) ;
227-
228- // Note: This must be done after initialization of the block's fields.
229- this . recomputeAriaLabel ( ) ;
230227 }
231228
232229 private recomputeAriaLabel ( ) {
@@ -239,15 +236,19 @@ export class BlockSvg
239236
240237 private computeAriaLabel ( ) : string {
241238 // Guess the block's aria label based on its field labels.
242- if ( this . isShadow ( ) ) {
239+ if ( this . isShadow ( ) || this . isSimpleReporter ( ) ) {
243240 // TODO: Shadows may have more than one field.
244241 // Shadow blocks are best represented directly by their field since they
245242 // effectively operate like a field does for keyboard navigation purposes.
246243 const field = Array . from ( this . getFields ( ) ) [ 0 ] ;
247- return (
248- aria . getState ( field . getFocusableElement ( ) , aria . State . LABEL ) ??
249- 'Unknown?'
250- ) ;
244+ try {
245+ return (
246+ aria . getState ( field . getFocusableElement ( ) , aria . State . LABEL ) ??
247+ 'Unknown?'
248+ ) ;
249+ } catch {
250+ return 'Unknown?' ;
251+ }
251252 }
252253
253254 const fieldLabels = [ ] ;
@@ -306,6 +307,8 @@ export class BlockSvg
306307 if ( ! svg . parentNode ) {
307308 this . workspace . getCanvas ( ) . appendChild ( svg ) ;
308309 }
310+ // Note: This must be done after initialization of the block's fields.
311+ this . recomputeAriaLabel ( ) ;
309312 this . initialized = true ;
310313 }
311314
You can’t perform that action at this time.
0 commit comments