Skip to content

feat: introduce Section as a new question type - #3664

Draft
Koc wants to merge 7 commits into
feat/conditional-questions-5-scale-colorfrom
feat/add-new-type-section-continue
Draft

Koc wants to merge 7 commits into
feat/conditional-questions-5-scale-colorfrom
feat/add-new-type-section-continue

Conversation

@Koc

@Koc Koc commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

This is continuation of the #2913 and #2824 but rebased and adopted to Vue3 and composition API.

Stack

Sections build on conditional questions. Each PR is based on the one before it and works on its own. Review and merge from the top.

Conditional questions:

  1. Conditional questions: go to a question based on the answer #3833 Conditional questions: go to a question based on the answer
  2. Conditional questions: go to a question after checkbox questions #3834 Conditional questions: go to a question after checkbox questions
  3. Conditional questions: go to a question after date and time questions #3835 Conditional questions: go to a question after date and time questions
  4. Conditional questions: go to a question based on the value of a linear scale #3837 Conditional questions: go to a question based on the value of a linear scale

Sections:

  1. feat: introduce Section as a new question type #3664 Sections as a question type: numbering, the frame and bar in the editor, every question in a section ← this PR
  2. feat(section): show one page per section #4007 One page per section
  3. feat(section): limit jumps to the start of a section #4008 Jumps go to the start of a section
  4. feat(section): go to a chosen section after a section #4009 "After this section go to …"
  5. feat(section): ask whether deleting a section keeps its questions #4010 Delete a section
  6. feat(section): reorder sections in a dialog #4011 Reorder sections in a dialog
  7. feat(section): show sections as headings in the results summary #4012 Section headings in the results summary

Untitled sections

  • Respondents no longer lose a section without a title: it shows no heading, but its description if it has one, and its questions are headed like questions outside a section, so the heading outline does not skip a level. A section with neither title nor description shows nothing. From feat(section): show one page per section #4007 on it still starts its own page.
  • The editor keeps warning "This section needs a title!".

Sections in the editor

  • Once a form has a section, every question is in a section. Adding a section below existing questions first puts them into a section titled "Untitled section", which can be renamed or cleared: a section inserted between questions splits them into two sections, one added at the end follows a section with all questions before it.
  • The server rejects new, copied or reordered questions that would sit before the first section, and the editor does not offer such moves. Deleting the first section moves its questions into the next section; deleting the only section leaves a form without sections.
  • Each section and its questions sit in a bordered frame. A bar at the top reads "Section N of M" and holds the section's menu; the label follows reordering, adding and deleting sections.
  • While the questions of a section scroll past, its bar sticks below the top bar with the section's number, title and menu; nothing scrolls visibly behind it. A long title ends with an ellipsis and shows in full on hover.
  • When the question column is too narrow for the frame to reach past it, as on a phone or with the sidebar open, the frame stays inside the column.
Light Dark
Editor with three framed sections in light mode Editor with three framed sections in dark mode
Sticky section bar with its menu while scrolling through section 2, light mode Sticky section bar with its menu while scrolling through section 2, dark mode
Framed sections on a phone screen, light mode Framed sections on a phone screen, dark mode
Sticky section bar on a phone screen, light mode Sticky section bar on a phone screen, dark mode

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI (N/A)

@codecov

codecov Bot commented Sep 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@AndyScherzinger

Copy link
Copy Markdown
Member

Hi @Koc, thanks for picking this up! A heads-up and three questions, because #3123 has changed in the meantime.

#3123 is now split into the stack #3833 → #3838, and conditional logic is no longer a question type of its own: branches are part of a normal question (extraSettings.branches), and follow-up questions are question rows with parentQuestionId and branchId (background in #3123 (comment)). So parentQuestionId now means "follow-up question of a branch", and the top-level lists, validation and export treat every question with a parent that way.

The good news: your diff already models sections the way Google Forms does, as an item in the ordered list that groups the questions up to the next section (like Google's PageBreakItem), without parentQuestionId. That fits well.

  1. parentQuestionId: the description mentions reusing it for sections. Could you drop that plan and keep sections as items in the list, as the code does now? Otherwise one column would carry two meanings.
  2. Pages: right now all sections are shown on one page with sticky headings. Is that meant as the end result, or as a step towards one section per page with Next/Back, like Google Forms? For "go to section based on answer" later on, sections need to be pages, with required questions checked per page before Next.
  3. Numbering: a section currently takes a question number (the counter also goes up for sections), so the question after a section at position 2 is numbered 3. I think sections should not be numbered. Do you agree?

Navigation between sections ("after this section go to …", and "go to section" on radio and dropdown options) would then build on top of this as a follow-up.

The stack and this PR both change the question list in Submit.vue; the conflict should be easy to resolve, follow-up questions just stay in the group of their question.

@AndyScherzinger

Copy link
Copy Markdown
Member

Hi @Koc, a short update on timing, so you know what to expect from my side.

I am finishing the iteration on conditional questions first. That is the stack starting at #3833, which is being reworked right now (#3833 (comment); it is now #3833 → #3834 → #3835 → #3837).

Once that iteration is done, sections are a good next step, and I will get back to you and your work here then. My three questions above stay open until then.

@AndyScherzinger

Copy link
Copy Markdown
Member

Hi @Koc, an update to my comment from 7 November, because the conditional questions stack has changed its model since then and parts of that comment no longer hold.

What changed in the stack

What this means for sections

  • Question 1 (parentQuestionId) is moot: the column is gone. Keeping sections as items in the ordered list, as your diff does, is exactly right. A section item then becomes a valid jump target without any format change.
  • Inside a section, the jumps keep the Microsoft behaviour: questions are revealed one after another, and an answer can skip a later question of the same section. When several questions of a section have jumps that leave the section, the first one decides, and the editor should warn about that case.
  • "After this section go to …" will use the same next key on the section item, and "go to section" on an answer is just a section id as goTo target. Both are follow-ups, not part of this PR. Backward jumps between sections (as Google Forms allows) are planned there too, with a server-side guard.
  • Questions 2 (one section per page with Next/Back, required questions checked per page) and 3 (sections take no question number) still stand. Numbering also matters for the jump targets in the editor, which are labelled "Question N: title".

Conflict with the stack

The note about follow-up questions staying in the group of their question is obsolete. Submit.vue now renders the respondent's path: questions are wrapped in KeepAlive and shown when they are in visibleQuestionIds, computed by getVisibleQuestions() in src/utils/Jumps.ts, mirrored on the server by SubmissionService::getVisibleQuestions(). A section item has to pass through that walk like a question without an answer, on both sides, and must not end the path.

I'll get back to you once the stack is merged; this PR should then be rebased onto main with it.

Assisted by Claude Code:claude-opus-5-5

@AndyScherzinger
AndyScherzinger force-pushed the feat/add-new-type-section-continue branch from 65eb910 to e912e38 Compare November 23, 2026 17:27
@AndyScherzinger
AndyScherzinger changed the base branch from main to feat/conditional-questions-5-scale-color November 23, 2026 17:27
@AndyScherzinger

Copy link
Copy Markdown
Member

Hi @Koc, a heads-up: I rebased this branch onto the conditional questions stack and force-pushed it, and the PR now targets feat/conditional-questions-5-scale-color (#3837).

Your commit stays yours. It is unchanged apart from the conflict resolution: you are still the author, and message and sign-off are untouched. Resolved conflicts:

  • ResponseDefinitions.php / openapi.json: section is added to the current type list (which now also has linearscale, color and ranking).
  • Submit.vue: the template keeps the stack's question list (it renders the respondent's path via visibleQuestionIds). groupedQuestions is still in the commit and will be wired up on top.

What happens next. All further changes go into separate commits on top of yours, partly in this PR and partly in stacked follow-up PRs. Sections will follow Microsoft Forms:

  • one page per section with Next/Back, and required questions checked per page;
  • sections as jump targets, and "after this section go to …";
  • no question number for sections, while question numbers follow the respondent's visible path;
  • deleting and moving a section with its questions;
  • section headings in the results summary.

The first commits on top fix the sections in the path logic (client and server) and four type errors in QuestionSection.vue. They also drop the sticky headings, since sections become pages.

Thanks for the groundwork; the model of a section as an item in the list fits the jumps perfectly.

Assisted by Claude Code:claude-opus-5-5

@AndyScherzinger

AndyScherzinger commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Pushed three commits on top of the original one, which stays as it is:

  • refactor(section): show a section as a plain heading: drops the sticky section headers, so a section is a heading with a description and a divider.
  • feat(section): number sections apart from the questions: sections count on their own, and questions no longer count sections. A later section stays a jump target, listed as "Section N: title" instead of taking a question number. Copying a section is hidden until duplication is designed.
  • test(section): cover sections on the respondent's path: four cases in the shared client/server jump path fixture, plus playwright/e2e/sections.spec.ts.
Before After
Jump targets before: the section is listed as question 2 and Comments as question 5 Jump targets after: the section is listed as section 1, Comments is question 4
Submit view before Submit view after: a plain heading that no longer sticks while scrolling

Assisted by Claude Code:claude-opus-5-5

@AndyScherzinger
AndyScherzinger force-pushed the feat/add-new-type-section-continue branch from 5b10e0b to 583ce5d Compare November 25, 2026 14:45
@AndyScherzinger

AndyScherzinger commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

Each section and its questions now sit in a frame in the editor (3315a20). A bar at the top reads "Section N of M" and holds the section's menu; the label follows reordering, adding and deleting sections. While the questions of a section scroll past, a sticky bar below the top bar keeps showing the section's number and title. Colours are theme tokens: --color-primary-element-light for the bars with --color-main-text for their text and menu, --color-border-dark for the frame. Questions before the first section stay unframed, and dragging questions between sections works as before.

Light Dark
Editor with two framed sections in light mode Editor with two framed sections in dark mode
Sticky section bar while scrolling through section 1, light mode Sticky section bar while scrolling through section 1, dark mode

Assisted by Claude Code:claude-opus-5-5

@AndyScherzinger
AndyScherzinger force-pushed the feat/add-new-type-section-continue branch from 583ce5d to 6cabaea Compare November 25, 2026 15:14
@jancborchardt

Copy link
Copy Markdown
Member

@AndyScherzinger nice! I think the extra gray background is not needed, border is enough. (Makes it look a bit old style otherwise.) And the Section heading could be sticky, that would help with orienting.

@Chartman123

Chartman123 commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

@AndyScherzinger Google automatically adds the Form title and description as well as all questions above a newly inserted section to Section 1:

image

What do you think about this? So technically we could always set a section 1 tag to all questions even if there are no other sections available.

@AndyScherzinger
AndyScherzinger force-pushed the feat/add-new-type-section-continue branch from 6cabaea to 3315a20 Compare November 26, 2026 14:13
@AndyScherzinger

Copy link
Copy Markdown
Member

@jancborchardt thanks, both are in 3315a20:

  • The grey background is gone, the frame is the border only.
  • While you scroll through a section, a sticky bar below the top bar shows its number and title, and it disappears again at the end of the section. It is a separate bar rather than the section's own heading, because the questions are siblings of the section in the list, so a sticky heading inside the section would scroll away with it.

Updated screenshots, including the sticky bar: #3664 (comment)

Assisted by Claude Code:claude-opus-5-5

@AndyScherzinger

Copy link
Copy Markdown
Member

@Chartman123 happy to look into it. I would keep the form "header" out of the section, since it is technically not in the section but the general overall header. Si what you ask for is that when introducing a section, all the above questions shall be moved into a section 1 and all below in section 2?

@Chartman123

Copy link
Copy Markdown
Collaborator

@AndyScherzinger yes, or that all questions even are already in section 1 but the section has no special visual representation until there is a second section.

@AndyScherzinger
AndyScherzinger force-pushed the feat/add-new-type-section-continue branch 3 times, most recently from ecec276 to 4f6d08b Compare November 26, 2026 21:41
@AndyScherzinger

Copy link
Copy Markdown
Member

@Chartman123 Done ✅ When adding a first section to a form, i.e. at the end or somewhere in the middle, all questions above will be auto-put into a section, so 2 sections get created.

Koc and others added 2 commits November 27, 2026 21:28
Signed-off-by: Kostiantyn Miakshyn <molodchick@gmail.com>
A section no longer sticks to the top of the page while the respondent
scrolls, so the observer, the sentinel element and the grouping of the
questions by section are gone. Sections become pages of their own in
a later step, where a sticking heading has no purpose.

The questions that follow a section get a heading one level below the
section's, so the heading outline of the form follows its sections.
Forms without sections keep their headings as before.

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
@AndyScherzinger
AndyScherzinger force-pushed the feat/conditional-questions-5-scale-color branch from ce6901a to b3bb42f Compare November 27, 2026 20:29
@AndyScherzinger
AndyScherzinger force-pushed the feat/add-new-type-section-continue branch from e6be8c9 to 2704516 Compare November 27, 2026 20:29
Sections count on their own and no longer take a question number, so
the questions keep the numbers respondents expect. The submit view
numbers the questions along the respondent's path, jump targets list
a later section as "Section N" and the questions by their own number,
and copying a section is left out until duplicating sections is
designed.

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
The shared jump path cases now include sections, so client and server
agree that a section shows like a question without an answer and is
skipped by a jump over it. The end-to-end test covers the numbering in
the editor, the jump targets and a submission around a section.

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
A section takes no answers, but values that read as empty, such as an
empty string or "0", passed the check and were stored as answers of the
section. Any non-empty answer list for a section is now rejected.

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
In the flat question list it was hard to see where a section ends.
A border now runs from each section down to its last question, headed
by a bar in a light primary shade that reads "Section N of M" and holds
the section's menu. While the questions of a section scroll past, a
sticky bar below the top bar keeps showing which section they belong
to. The frame is drawn around the items, so dragging questions into
another section and the list structure stay as they are, and the
labels follow any change of the order or the number of sections.

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Once a form has a section, every question belongs to one. Questions
before the first section were an untitled lead-in that the editor
could neither frame nor handle like a section.

The editor creates the first section, with "Untitled section" filled
in as its title, when a section is added below existing questions: a
section inserted between questions splits them into two sections, one
appended at the end follows a section holding all questions before it.

The server rejects new, copied and reordered questions that would add
to the questions before the first section, so API clients cannot bring
them back. Deleting the first section moves the next section up to its
place, so its questions join that section; jumps that become backward
by this are removed and reported in X-Forms-Adjusted.

Forms stored with questions before the first section keep them, and
requests that do not add to them keep working.

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
@AndyScherzinger
AndyScherzinger force-pushed the feat/add-new-type-section-continue branch from 2704516 to ea506f5 Compare November 27, 2026 20:33
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.

4 participants