Skip to content

DataMapper: Nested choice wrapper context menu does not show inner choice members #3184

@mmelko

Description

@mmelko

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

  1. Create a schema with a nested xs:choice — an outer choice where one member is itself a choice wrapper
  2. Select a member in the outer choice (the one that is a nested choice wrapper)
  3. 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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    DataMapperAll issues related to the DataMapperbugSomething isn't working

    Type

    Projects

    Status

    Todo

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions