#3540959 Make sure only the previously selected answers are selected when...

#3540959 Make sure only the previously selected answers are selected when revisiting a checkbox activity

Closes #3540959

Preserve LMS checkbox answers during back navigation

Problem

When a learner navigates back to a previously answered multiple-select question, the original checkbox selections are not restored correctly. In some cases, the first option appears selected instead.

The issue occurs because LMS stores checkbox submissions as an option_id => option_id|0 map, while Drupal Form API expects checkbox defaults as a list of selected option keys.

Changes

  • Normalize stored checkbox answers with Drupal’s Checkboxes::getCheckedCheckboxes() helper.
  • Add regression coverage for plain and feedback multiple-select activities.
  • Ensure the regression test selects a non-first option and verifies that the same selection is restored after back navigation.

Merge request reports

Loading
Loading