Skip to content

feat(media): show an image, video or audio item on every question - #4078

Merged
Chartman123 merged 1 commit into
mainfrom
feat/question-media
Dec 3, 2026
Merged

Chartman123 merged 1 commit into
mainfrom
feat/question-media

Conversation

@AndyScherzinger

@AndyScherzinger AndyScherzinger commented Dec 2, 2026 •

Copy link
Copy Markdown
Member

Follow-up to #4076 (content block), which is merged.

What it solves

An image, a clip or a recording often belongs to the question it explains, not to a block of its own: "What do you see in this picture?" needs the picture right next to its answer field. With #4076 alone, the item has to sit in a separate content block above the question.

What changed

  • Every question type now accepts the extra setting media that content blocks use ({url, alt, type}, see docs/DataStructure.md). The server detects the type on save exactly as for content blocks: YouTube/Vimeo, or a public share of this Nextcloud looked up through the share manager. No other address is ever fetched.
  • The item is shown below the question's description, inside the question, in the logged-in app, on public links and in embedded forms.
  • In the editor, the actions of a question get Add image, video or audio. It shows the address field and moves the focus to it. Remove image, video or audio takes it away again. Content blocks keep the field always visible.
  • The answer fields of a question name the item in their accessible description, next to the question's description, so screen reader users hear it while answering.
  • The results summary shows each question's item, with the same consent notice for YouTube and Vimeo.
  • The media display and fields move from the content block into a QuestionMedia component that Question renders for every type. The media helpers of the e2e tests move into playwright/support/media.ts.
  • One item per question. Media on answer options (Adding images to options of multiple choice questions #441) is out of scope.

How to test

  1. Add a short answer question with a description. Open its actions and choose Add image, video or audio. The address field appears and has the focus.
  2. Paste the public share link of an image and add a description for screen readers. The image shows between the description and the answer field, in the editor and in View.
  3. Do the same on a checkbox question with an audio share, and on a linear scale with a YouTube address. The audio player and the consent notice show inside the question.
  4. Submit the form and open Responses. The summary shows each question's item.

E2E coverage: playwright/e2e/question-media.spec.ts. Unit tests: new cases in FormsServiceTest.

Screenshots

Taken on Nextcloud 35 with the head of this branch.

Actions of a question:

Actions menu of a question with the entry Add image, video or audio

A form with an image on a short answer, a video on radio buttons, audio on checkboxes and a YouTube video on a linear scale:

Editor Submit view
Editor with media on four questions Submit view with media on four questions

320 px wide screen:

Editor Submit view
Editor on a 320 pixel wide screen Submit view on a 320 pixel wide screen

Results summary:

Results summary showing the media of each question

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI

@codecov

codecov Bot commented Dec 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@AndyScherzinger
AndyScherzinger force-pushed the feat/question-media branch 2 times, most recently from 2afc3c7 to a6209f0 Compare December 2, 2026 21:50
@AndyScherzinger AndyScherzinger mentioned this pull request Dec 3, 2026
1 task done
Base automatically changed from feat/content-block to main December 3, 2026 13:25
A picture, a clip or a recording often belongs to the question it
explains, not to a block of its own: "What do you see in this image?"
needs the image right next to its answer field. Every question type now
accepts the extra setting `media` that content blocks use, and shows it
below the description, inside the question.

The editor offers "Add image, video or audio" in the actions of a
question, which shows the address field and moves the focus to it, and
"Remove image, video or audio" to take it away again; content blocks
keep the field always visible. The answer fields of a question name the
item in their accessible description next to the question's description,
so screen reader users hear it while answering. The results summary
shows the item of a question as well, with the same consent notice for
YouTube and Vimeo.

The display and the fields move from the content block into a
QuestionMedia component that Question renders for every type, and the
media helpers of the e2e tests into a shared support file.

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
@Chartman123
Chartman123 merged commit 2f33d31 into main Dec 3, 2026
54 checks passed
@Chartman123
Chartman123 deleted the feat/question-media branch December 3, 2026 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants