babylonjs-accessibility 6.14.1 → 6.14.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -31251,7 +31251,12 @@ class HTMLTwinHostComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Component
31251
31251
  const scene = this.props.scene;
31252
31252
  // Find all a11y entities in the scene, assemble the a11y forest (a11yTreeItems), and update React state to let React update DOM.
31253
31253
  const updateA11yTree = () => {
31254
- this._updateHTMLTwinItems();
31254
+ // Delay the call to _updateHTMLTwinItems because during its execution, _isMeshGUI will be called and may access node.sourceMesh
31255
+ // if node is an instanced mesh, but at this stage, the InstancedMesh constructor has not yet been executed and sourceMesh is undefined.
31256
+ // The delay will give time for the InstancedMesh constructor to be executed.
31257
+ setTimeout(() => {
31258
+ this._updateHTMLTwinItems();
31259
+ });
31255
31260
  };
31256
31261
  const addGUIObservers = (control) => {
31257
31262
  // observe isVisible changed
@@ -31293,12 +31298,17 @@ class HTMLTwinHostComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Component
31293
31298
  this._observersMap.set(node.onAccessibilityTagChangedObservable, node.onAccessibilityTagChangedObservable.add(updateA11yTree));
31294
31299
  }
31295
31300
  // If the node has GUI, add observer to the controls
31296
- if (this._isMeshGUI(node)) {
31297
- const curMesh = node;
31298
- const adt = curMesh.material?.getActiveTextures()[0];
31299
- const guiRoot = adt.getChildren();
31300
- guiRoot.forEach((control) => addGUIObservers(control));
31301
- }
31301
+ // Delays the call to _isMeshGUI because it can access node.sourceMesh if node is an instanced mesh, but at this stage
31302
+ // the InstancedMesh constructor has not yet been executed and sourceMesh is undefined.
31303
+ // The delay will give time for the InstancedMesh constructor to be executed.
31304
+ setTimeout(() => {
31305
+ if (this._isMeshGUI(node)) {
31306
+ const curMesh = node;
31307
+ const adt = curMesh.material?.getActiveTextures()[0];
31308
+ const guiRoot = adt.getChildren();
31309
+ guiRoot.forEach((control) => addGUIObservers(control));
31310
+ }
31311
+ });
31302
31312
  };
31303
31313
  const _updateAndAddNode = (node) => {
31304
31314
  updateA11yTree();