babylonjs-accessibility 6.15.0 → 6.16.1

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.
@@ -31239,7 +31239,6 @@ __webpack_require__.r(__webpack_exports__);
31239
31239
 
31240
31240
 
31241
31241
 
31242
-
31243
31242
  class HTMLTwinHostComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Component {
31244
31243
  constructor(props) {
31245
31244
  super(props);
@@ -31445,6 +31444,17 @@ class HTMLTwinHostComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Component
31445
31444
  }
31446
31445
  return result;
31447
31446
  }
31447
+ _hasChildrenWithA11yTag(node) {
31448
+ let result = false;
31449
+ const descendants = node.getDescendants();
31450
+ for (const child of descendants) {
31451
+ if (child.accessibilityTag?.description) {
31452
+ result = true;
31453
+ break;
31454
+ }
31455
+ }
31456
+ return result;
31457
+ }
31448
31458
  _getHTMLTwinItemsFromGUI(rootItems) {
31449
31459
  if (!rootItems || rootItems.length === 0) {
31450
31460
  return [];
@@ -31453,14 +31463,17 @@ class HTMLTwinHostComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Component
31453
31463
  const queue = [...rootItems];
31454
31464
  for (let i = 0; i < queue.length; i++) {
31455
31465
  const curNode = queue[i];
31456
- if (!curNode.isVisible || (!this._options.addAllControls && curNode.name !== "root" && !curNode.accessibilityTag?.description)) {
31466
+ const numOfDirectChildren = curNode.getDescendants(true).length;
31467
+ if (!curNode.isVisible || (!this._options.addAllControls && !curNode.accessibilityTag?.description && numOfDirectChildren === 0)) {
31457
31468
  continue;
31458
31469
  }
31459
- if (curNode instanceof gui_2D_advancedDynamicTexture__WEBPACK_IMPORTED_MODULE_6__.Container && curNode.children.length !== 0 && !(curNode instanceof gui_2D_advancedDynamicTexture__WEBPACK_IMPORTED_MODULE_6__.Button)) {
31470
+ if (curNode.getClassName() !== "Button" && // curNode = Non Button -> Container or not
31471
+ numOfDirectChildren > 0 && // curNode = Non Button Container
31472
+ (this._options.addAllControls || this._hasChildrenWithA11yTag(curNode))) {
31460
31473
  const curContainer = curNode;
31461
31474
  result.push(new _htmlTwinGUIItem__WEBPACK_IMPORTED_MODULE_3__.HTMLTwinGUIItem(curContainer, this.props.scene, this._getHTMLTwinItemsFromGUI(curContainer.children)));
31462
31475
  }
31463
- else {
31476
+ else if (this._options.addAllControls || curNode.accessibilityTag?.description) {
31464
31477
  result.push(new _htmlTwinGUIItem__WEBPACK_IMPORTED_MODULE_3__.HTMLTwinGUIItem(curNode, this.props.scene, []));
31465
31478
  }
31466
31479
  }