Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(bug): Nodes expanded state are not updated when search #662 #664

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions src/tree-node/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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
}
Expand Down
Loading