Skip to content
Permalink
Browse files
fix: Tree keyboard movement for child items that are expanded
The tree will now correctly not consider items visible if the direct
parent is expanded, but a parent above is closed.
  • Loading branch information
mlaursen committed Jul 12, 2020
1 parent eef48dc commit fadddc7798be9179a9db8a937455b9d989e38c79
Showing 1 changed file with 6 additions and 3 deletions.
@@ -142,9 +142,12 @@ export default function useFlattenedTreeList({
return flattenedItems.reduce<ItemCollection>(
(collection, item) => {
const { parentId, itemId } = item;
const isVisible =
parentId === rootId ||
(parentId !== null && expandedIds.includes(parentId));
let isVisible = parentId === rootId;
if (parentId !== null && expandedIds.includes(parentId)) {
// need to also make sure that the parent is visible
isVisible =
(collection.itemRefs[parentId]?.visibleIndex ?? -1) !== -1;
}

collection.itemRefs[itemId] = {
id: item.id,

0 comments on commit fadddc7

Please sign in to comment.