Hiding Cascades once Answered

Is there a way for a boxed cascade to close once credit has been earned? Similar to how <hint> and <feedback> can be closed? I am using <sideBySide> and I want problems to collapse once they are completed.

Hmm. It doesn’t seem like <section> even has the collapsible attribute. Currently, it only exists on an <aside> and a <proof>.

If, just for testing, you used an <aside>, would that give you want you want?

<cascade>
  <aside name="section1" startOpen>
    <answer name="ans1"><label>1+1=</label>2</answer>
  </aside>
  <aside name="section2" startOpen>
    <answer name="ans2"><label>1+1=</label>2</answer>
  </aside>

  <updateValue triggerWhen="$section1.creditAchieved=1" target="$section1.open" type="boolean" newValue="false" />
  <updateValue triggerWhen="$section2.creditAchieved=1" target="$section2.open" type="boolean" newValue="false" />
  
</cascade>

It’s kinda strange how one can “open” and “close” the later section even when it is empty. Not sure if we need more control over what can trigger opening or closing the section.

If this behavior of <aside> was fine, it’d be simple enough to add the collapsible attribute to all sectional components (sections, problems, etc.). I’m not sure why they don’t have it.

I have used <aside> quite a lot on long problems like AC Previews because of the collapsibility, not because it’s semantically correct for what we’re doing. It’s also title-able, so students never see the word “aside”.

Probably the closest semantically would be task, but I need letter markers not numbers. Right now I manually title the aside something like “a. description of the contents.”

I think having collapsible on other things would be great.

Yes! Being able to collapse other things would be extremely helpful.

I added this feature request for collapsible sections.

Thank you! Will the default behavior be “Click to Close” like it is on a <hint> or <feedback>?

The <hint> and <feedback> tags are completely separate components (in the DoenetML internals). So, if I just add the collapsible attribute, sections won’t act like <hint> or <feedback>; they will act like an <aside> or <proof>.

That’s not to say we can’t improve how <aside> or new collapsible sections work. Only that it would involve more work on your part in calling for or arguing for changes.

I think I could make it work with asides. But I’d rather have Cascades that close automatically based on credit achievement for that section.

All sectional components can now be collapsible in the latest dev version of DoenetML.

You can make them close automatically with

<cascade>
  <problem name="problem1" collapsible>
    <answer name="ans1"><label>1+1=</label>2</answer>
  </problem>
  <problem name="problem2" collapsible>
    <answer name="ans2"><label>1+1=</label>2</answer>
  </problem>

  <updateValue triggerWhen="$problem1.creditAchieved=1" target="$problem1.open" type="boolean" newValue="false" />
  <updateValue triggerWhen="$problem2.creditAchieved=1" target="$problem2.open" type="boolean" newValue="false" />
  
</cascade>

I haven’t figured out a nicer way to do it. We’d need to have further discussions to figure out a better way for it to work.