kolibri icon indicating copy to clipboard operation
kolibri copied to clipboard

Render inline choice content in the QTI inline choice dropdown

Open rtibbles opened this issue 3 weeks ago • 2 comments

Overview

In QTI 3.0, a qti-inline-choice can contain MathML, images and inline HTML as well as text. InlineChoiceInteraction flattens each choice to plain text and shows only that text in the dropdown and the trigger, so math shows as its alttext or its raw token text, images as their alt, and formatting is lost.

Complexity: Medium Target branch: develop

Context

  • choiceText flattens each choice once: https://github.com/learningequality/kolibri/blob/3de284ad1c28fdedc433a61c115e8a73ef246808/kolibri/plugins/qti_viewer/frontend/components/interactions/InlineChoiceInteraction.vue#L112
  • KDropdownMenu gets that text as each option's label, and the component's #option slot renders option.label:
    • https://github.com/learningequality/kolibri/blob/3de284ad1c28fdedc433a61c115e8a73ef246808/kolibri/plugins/qti_viewer/frontend/components/interactions/InlineChoiceInteraction.vue#L127
    • https://github.com/learningequality/kolibri/blob/3de284ad1c28fdedc433a61c115e8a73ef246808/kolibri/plugins/qti_viewer/frontend/components/interactions/InlineChoiceInteraction.vue#L23-L40
  • The trigger, and the non-interactive rendering used in quiz reports, show triggerLabel as text:
    • https://github.com/learningequality/kolibri/blob/3de284ad1c28fdedc433a61c115e8a73ef246808/kolibri/plugins/qti_viewer/frontend/components/interactions/InlineChoiceInteraction.vue#L18
    • https://github.com/learningequality/kolibri/blob/3de284ad1c28fdedc433a61c115e8a73ef246808/kolibri/plugins/qti_viewer/frontend/components/interactions/InlineChoiceInteraction.vue#L48

The Change

  • The dropdown options, the trigger and the non-interactive rendering should render each choice's authored content, the same way the rest of the item body is rendered.
  • choiceText should still provide the trigger's accessible name and the selection announcement.
  • Vue 2 can't mount the same vnodes in more than one place, so each place that renders a choice's content needs its own copy.

How to Get There

  1. Run pnpm devserver and open http://127.0.0.1:8000/en/learn/#/qti_sandbox/q12-inline-choice-mathml.
  2. Open the dropdown. Each option reads as plain text such as x = y, not rendered math.
  3. Untick Interactive? to see the non-interactive rendering.

Acceptance Criteria

General

  • [ ] A choice containing MathML shows the rendered math in the dropdown, in the trigger once selected, and in the non-interactive rendering.
  • [ ] A choice containing an image shows the image in the same three places.
  • [ ] Inline formatting in a choice (em, sub, sup, span) renders in the same three places.
  • [ ] The QTI sandbox has inline choice items whose choices contain an image and formatted text, beside the existing Inline Choice - MathML item.

Accessibility and i18n

  • [ ] Screen readers announce the trigger and the selected choice by the same accessible names as before.
  • [ ] A choice written in a right-to-left script still reads right to left in the dropdown and the trigger.

Testing

  • [ ] Tests cover choices with MathML, an image and formatted text, in the dropdown, the trigger and the non-interactive rendering.

References

  • QTI 3.0 schema, InlineChoiceDType: https://purl.imsglobal.org/spec/qti/v3p0/schema/xsd/imsqti_asiv3p0_v1p0.xsd

AI usage

While reviewing #15625 I decided the dropdown must render QTI 3 inline content, and asked for this issue. Claude Code checked the QTI 3.0 schema and the component code, and drafted the issue.

rtibbles avatar Nov 07 '26 01:11 rtibbles

assign

ArpitaSamanta10 avatar Nov 09 '26 06:11 ArpitaSamanta10

Hi! 👋

Thanks so much for your interest! This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues. If there are no unassigned 'help wanted' issues available, please wait until new ones are added.

We really appreciate your willingness to help. 😊

Are you preparing for Google Summer of Code? See our GSoC guidelines.

learning-equality-bot avatar Nov 09 '26 06:11 learning-equality-bot