From 907a15739bbcff44e4298cecf7745fb2c5897dc6 Mon Sep 17 00:00:00 2001 From: "parth.satasiya" Date: Sat, 9 Mar 2024 21:05:01 +0530 Subject: [PATCH] fix(bug): Nodes expanded state are not updated when search #662 --- src/tree-node/index.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/tree-node/index.js b/src/tree-node/index.js index 4c58a49c..2ab04274 100644 --- a/src/tree-node/index.js +++ b/src/tree-node/index.js @@ -73,7 +73,18 @@ class TreeNode extends PureComponent { } getAriaAttributes = () => { - const { _children, _depth, checked, disabled, expanded, readOnly, mode, partial } = this.props + const { + _children, + _depth, + checked, + disabled, + expanded, + keepTreeOnSearch, + mode, + partial, + readOnly, + searchModeOn, + } = this.props const attributes = {} attributes.role = mode === 'simpleSelect' ? 'option' : 'treeitem' @@ -82,7 +93,8 @@ class TreeNode extends PureComponent { if (mode !== 'simpleSelect') { attributes['aria-checked'] = partial ? 'mixed' : checked attributes['aria-level'] = (_depth || 0) + 1 - attributes['aria-expanded'] = _children && (expanded ? 'true' : 'false') + attributes['aria-expanded'] = + _children && (searchModeOn && keepTreeOnSearch ? 'true' : expanded ? 'true' : 'false') } return attributes }