Problem/Motivation

#3639708 (1.2.7) renders the activity inside the answer form on every course step, so the answer elements can be placed among the activity fields. That changed the markup for all sites and breaks themes:

  • Selectors that style the activity fields next to the form stop matching.
  • Form styles reach the activity. Greendale's form { display: flex; flex-direction: column; align-items: flex-start } shrinks the activity fields to their content: 100% wide oEmbed videos render about 300px wide, 100% wide tables collapse.
  • Answer form alters, e.g. classes centering the form, now apply to the activity too.

Also in 1.2.7:

  • Without Layout Builder, the answer elements render above the activity fields whatever the "Answer form" component weight. The form builder marks the still empty activity build #sorted, so its children render in insertion order.
  • The answer elements container repeats the form's lms-answer-form class, so styles set on it apply twice, nested.

Steps to reproduce

  1. On 1.2.7, open a course step with a select activity.
  2. The answer options render above the question. In Greendale, an oEmbed video in the activity renders about 300px wide.

Proposed resolution

  • Render the activity above the answer form, as in 1.2.6, unless its display places the answer form: the "Answer form" extra field is hidden by default, and the activity renders inside the form when it's enabled or the display uses Layout Builder.
  • Unset #sorted on the activity rendered in the form, so the component weight applies. Already committed to 1.2.x in 0f61c0d.
  • Rename the answer elements container class to lms-answer-elements.

User interface changes

The "Answer form" component is disabled by default on activity displays.

API changes

LmsLessonHandlerBase::getAnswerForm() returns the activity_build and form keys again, as in 1.2.6. When the activity display places the answer form, it returns the form, which renders the activity.

Release notes snippet

Restores the 1.2.6 course step markup. Rendering the activity inside the answer form is now opt-in: enable the "Answer form" component on the activity display, or use Layout Builder.

Issue fork lms-3641023

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

graber created an issue. See original summary.

graber’s picture

Title: Answer elements render above the activity fields, and their container repeats the form's lms-answer-form class » Course step markup change in 1.2.7 breaks themes
Issue summary: View changes

  • graber committed c22efe70 on 1.2.x
    #3641023: Rename the answer elements container class to lms-answer-...
graber’s picture

Assigned: graber » Unassigned
Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.