Skip to content

Changing a choice with children/nested choices does not clear the child choices #3859

Closed
@filpano

Description

@filpano

Describe the bug
I have the following situation:

- Choice A
  - Choice A1
  - Choice A2
- Choice B
  - Choice B1
  - Choice B2

A1, A2 and B1, B2 are only active, selectable and viewable when A or B respectively is selected.

Then, if I label my as follows:

A -> A1 -> B

I have both choice B and A1 active, which should not be possible normally. This is because the children of choices are not cleared when the parent is.

Is there are workaround for this behaviour?

To Reproduce
The following labeling config can reproduce this behaviour:

<View style="box-shadow: 2px 2px 5px #999;                padding: 20px; margin-top: 2em;                border-radius: 5px;">
    
  <Table name="table" value="test"/>

  <Choices name="level1" toName="table" choice="single-radio" showInLine="true" required="true">
    <Choice value="A"/>
    <Choice value="B"/>
  </Choices>
  
  <View visibleWhen="choice-selected" whenTagName="level1" whenChoiceValue="A">
    <Choices name="level2_A" toName="table" choice="single-radio" showInLine="true" visibleWhen="choice-selected" required="true" whenTagName="level1" whenChoiceValue="A">
      <Choice value="A1"/>
      <Choice value="A2"/>
    </Choices>
  </View>

  <View visibleWhen="choice-selected" whenTagName="level1" whenChoiceValue="B">
    <Choices name="level2_B" toName="table" choice="single-radio" showInLine="true" visibleWhen="choice-selected" required="true" whenTagName="level1" whenChoiceValue="B">
      <Choice value="B1"/>
      <Choice value="B2"/>
    </Choices>
  </View>
  
</View>

Expected behavior
In the above example, I would expect that changing the choice from A to B would clear the A1 child choice.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

  • OS: Ubuntu 20.04.5 LTS
  • Label Studio Version
{
  "release": "1.5.0dev",
  "label-studio-os-package": {
    "version": "1.5.0dev",
    "short_version": "1.5",
    "latest_version_from_pypi": null,
    "latest_version_upload_time": null,
    "current_version_is_outdated": false
  },

  "label-studio-os-backend": {},

  "label-studio-frontend": {
    "message": "feat: DEV-388: Introducing default attributes for AudioPlus (#818)  *  ...",
    "commit": "c0ff3e48032c3ab77c51835c632768b72730eecb",
    "branch": "master",
    "date": "2022-09-12T15:24:05Z"
  },

  "dm2": {
    "message": "feat: DEV-1752: Support links to drafts and annotations (#101)  * Supp ...",
    "commit": "72105e4385620cf4a59b5bd3e68adca19287bf8b",
    "branch": "master",
    "date": "2022-09-02T18:15:25Z"
  },

  "label-studio-converter": {
    "version": "0.0.44"
  }
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions