test(builder): cover useVisualViewport; fix: disable Select-Parent at ROOT in desktop context menu
- useVisualViewport.test.tsx: covers the visualViewport-undefined fallback, the keyboardInset math on a mocked visualViewport resize, and listener add/remove (resize + scroll) across mount/unmount. - ContextMenu.tsx: Select Parent was only disabled at isRoot, so selecting a top-level section and choosing Select Parent silently landed on the un-editable ROOT (no outline, no toolbar) -- a dead end. Switched the guard to useNodeActions' canSelectParent (false whenever the node's parent is ROOT or missing), matching the mobile selection toolbar's existing identical guard. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -195,7 +195,12 @@ export const ContextMenu: React.FC<ContextMenuProps> = ({
|
||||
label: 'Select Parent',
|
||||
icon: 'level-up',
|
||||
action: selectParent,
|
||||
disabled: isRoot,
|
||||
// Not just `isRoot`: the real dead-end is when nodeId's PARENT is
|
||||
// ROOT (selecting a top-level section -> Select Parent would only
|
||||
// select the page-wide, un-editable ROOT -- no outline, no toolbar).
|
||||
// `canSelectParent` (useNodeActions) already encodes that and matches
|
||||
// the mobile selection toolbar's identical guard.
|
||||
disabled: !nodeActions.canSelectParent,
|
||||
dividerAfter: true,
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user