Skip to content

Commit

Permalink
feat(TreeView): Fixing onSelectedItemChange (#1226)
Browse files Browse the repository at this point in the history
  • Loading branch information
silvalaura committed Jun 5, 2024
1 parent 88cebaa commit d9e20d0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/treeview-5.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"react-magma-dom": minor
---

feat(TreeView): TreeView & TreeItem updates
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export const Complex = args => {
label={<>Chapter 1: I love tiramisu jelly beans soufflé</>}
itemId="pt1ch1"
testId="pt1ch1"
isDisabled
// isDisabled
>
<TreeItem
icon={<ArticleIcon aria-hidden={true} />}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,7 @@ export function useTreeItem(props: UseTreeItemProps, forwardedRef) {
statusFromChildren
);


if (
checkedStatus !== statusFromChildren &&
statusUpdatedBy !== StatusUpdatedByOptions.parent
Expand Down Expand Up @@ -572,7 +573,7 @@ export function useTreeItem(props: UseTreeItemProps, forwardedRef) {
setCheckedStatus(status);
setStatusUpdatedBy(StatusUpdatedByOptions.checkboxChange);
updateParentCheckStatus(index, status);

if (hasOwnTreeItems) {
if (getAllChildrenEnabled(treeItemChildren)) {
setChildrenCheckedStatus(
Expand Down

0 comments on commit d9e20d0

Please sign in to comment.