Skip to content

FieldGridDropdown: recomputeAriaContext() throws when the field has no DOM element #2740

Description

@microbit-robert

Check for duplicates

  • I have searched for similar issues before opening a new one.

Component

FieldGridDropdown

Description

recomputeAriaContext() in FieldGridDropdown ignores the boolean returned by super.recomputeAriaContext() and then unconditionally calls getFocusableElement(), which throws. This can be observed when using the zelos renderer.

It should probably follow the pattern in core:

const shouldCustomize = super.recomputeAriaContext();
if (!shouldCustomize) return false;

Reproduction steps

  1. Running this repo locally, edit the test file for the field-grid-dropdown plugin (test/index.ts) by setting the renderer to zelos
  2. npm start
  3. Observe the following output:
Image

Stack trace

field currently has no representative DOM element.
    at FieldGridDropdown.getFocusableElement (webpack-internal:///../../node_modules/blockly/blockly_compressed.js:1084:175)
    at FieldGridDropdown.recomputeAriaContext (webpack-internal:///./src/index.ts:98:76)
    at hi.recomputeAriaContext (webpack-internal:///../../node_modules/blockly/blockly_compressed.js:1349:462)
    at hi.setShadow (webpack-internal:///../../node_modules/blockly/blockly_compressed.js:1330:184)
    at ee (webpack-internal:///../../node_modules/blockly/blockly_compressed.js:83:115)
    at ce (webpack-internal:///../../node_modules/blockly/blockly_compressed.js:82:168)
    at Li.createShadowBlock (webpack-internal:///../../node_modules/blockly/blockly_compressed.js:1214:245)
    at Li.respawnShadow_ (webpack-internal:///../../node_modules/blockly/blockly_compressed.js:1209:291)
    at Li.respawnShadow_ (webpack-internal:///../../node_modules/blockly/blockly_compressed.js:1224:169)
    at Li.setShadowStateInternal (webpack-internal:///../../node_modules/blockly/blockly_compressed.js:1213:502)

Screenshots

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    Fields

    No fields configured for Bug.

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions