Description
When a choice wrapper's selected member is itself a choice wrapper (nested choice), right-clicking the nested choice node only shows "Show All Choice Options" for the parent wrapper. The nested choice's own member list is not displayed, so users cannot select among the inner choice's members from the context menu.
Steps to reproduce
- Create a schema with a nested
xs:choice — an outer choice where one member is itself a choice wrapper
- Select a member in the outer choice (the one that is a nested choice wrapper)
- Right-click the nested choice node
Expected behavior
The context menu should show:
- "Show All Choice Options" (to clear the parent selection)
- The nested choice's own member list (inline or via "Select Member..." modal)
Actual behavior
Only "Show All Choice Options" for the parent wrapper is shown. The nested choice's own members are not accessible from the context menu.
Root cause
In useChoiceContextMenu, when isSelectedChoice is true, choiceWrapperField is set to nodeData.choiceField (the parent wrapper). The code does not check whether field itself is a choice wrapper (field.wrapperKind === 'choice') and therefore never builds menu groups for the nested wrapper's members.
Implementation notes
The fix requires:
- Detecting when
isSelectedChoice && field?.wrapperKind === 'choice' (nested choice wrapper)
- Adding separate handlers for the nested wrapper (reusing the existing generic
applyChoiceSelection/applyClearChoice)
- Building additional menu groups from the nested wrapper's members via
buildChoiceWrapperMenuGroups
- Supporting a separate modal state for the nested choice (if it has >10 members)
Description
When a choice wrapper's selected member is itself a choice wrapper (nested choice), right-clicking the nested choice node only shows "Show All Choice Options" for the parent wrapper. The nested choice's own member list is not displayed, so users cannot select among the inner choice's members from the context menu.
Steps to reproduce
xs:choice— an outer choice where one member is itself a choice wrapperExpected behavior
The context menu should show:
Actual behavior
Only "Show All Choice Options" for the parent wrapper is shown. The nested choice's own members are not accessible from the context menu.
Root cause
In
useChoiceContextMenu, whenisSelectedChoiceis true,choiceWrapperFieldis set tonodeData.choiceField(the parent wrapper). The code does not check whetherfielditself is a choice wrapper (field.wrapperKind === 'choice') and therefore never builds menu groups for the nested wrapper's members.Implementation notes
The fix requires:
isSelectedChoice && field?.wrapperKind === 'choice'(nested choice wrapper)applyChoiceSelection/applyClearChoice)buildChoiceWrapperMenuGroups