apluslms/mooc-grader

Question choice label does not connect to the input

markkuriekkinen opened this issue · 0 comments

Questionnaire HTML forms have labels that have outdated for attribute values. This concerns at least checkbox and radio button questions. The for value is not the same as the id attribute of the input and thus, clicking on the label does not tick the checkbox.

The id attributes were changed in A+ v1.8 (January 2021). The new id contains a random part so that the id is unique in the DOM even when the page (A+ content chapter) includes multiple exercises of the same type. The current label for values match the old ids that are not used any longer (the old ids were probably the Django default values).

Relevant code:

<label for="{{ choice.id_for_label }}" class="{% if choice.choice_value in choice.value %}option-checked{% endif %}">

kwargs.setdefault("auto_id", "exercise-{}-%s".format(random_id))