diff --git a/ui/leafwiki-ui/src/features/tree/TreeNode.tsx b/ui/leafwiki-ui/src/features/tree/TreeNode.tsx index 860a1ae3..2f4595b9 100644 --- a/ui/leafwiki-ui/src/features/tree/TreeNode.tsx +++ b/ui/leafwiki-ui/src/features/tree/TreeNode.tsx @@ -54,6 +54,22 @@ export const TreeNode = React.memo(function TreeNode({ to={`/${node.path}`} className="tree-node__link" data-testid={`tree-node-link-${node.id}`} + onClick={(e) => { + // Only toggle sections on click + if (node.kind !== NODE_KIND_SECTION) return + + // Prevent toggling when using modifier keys or middle mouse button + if ( + e.metaKey || + e.ctrlKey || + e.shiftKey || + e.altKey || + e.button === 1 + ) { + return + } + toggleNode(node.id) + }} >