fix: support single-question multiSelect in AskUserQuestion#17
Open
NOirBRight wants to merge 9 commits into
Open
fix: support single-question multiSelect in AskUserQuestion#17NOirBRight wants to merge 9 commits into
NOirBRight wants to merge 9 commits into
Conversation
added 9 commits
May 30, 2026 17:38
…tion - session-entry-renderer: isMulti now checks q.multiSelect, add data-multiple attribute and ask-question-multiselect class - live-renderer: same qaMulti check, data-multiple attribute and multiselect class - Both renderers show Submit button for single-question multiSelect cards - Added tests for data-multiple, multiselect class, and submit button visibility
- Dashed border for multiselect options - Checkbox indicators: ☑ for selected, ☐ for unselected
…rQuestion - Click handler: single question + multiSelect now toggles selection instead of sending immediately - Submit handler: multiSelect blocks collect all selected answers joined with commas - Added tests for toggle behavior and comma-separated submission
The export page has its own copy of the AskUserQuestion renderer in export/app/50-render-entry.js. Apply the same multiSelect fixes: - isMulti now checks q.multiSelect - data-multiple attribute on question blocks - ask-question-multiselect class on options
Detect free-text option labels heuristically: Type something, 其他/Other, 自定义/Custom, 自行输入/自由输入/Enter your. Single-select always shows freetext input; multi-select shows it when a free-text option is detected.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When
AskUserQuestionhas a single question withmultiSelect: true, clicking an option immediately sends the answer as a single choice — the same behavior as a single-question single-select. ThemultiSelectproperty is completely ignored.Also, the "Type something." free-text input row that pi TUI always shows for single-select questions was missing in pi-web entirely, and multi-select questions with free-text options (like "其他"/"Other"/"自定义"/"Custom") rendered them as regular buttons instead of text inputs.
Root Cause
Three layers all had the same bug:
Rendering:
data-multipleattribute andask-question-multiselectCSS class were never emitted for question blocks, so the UI had no way to distinguish multi-select from single-select.Click handling:
chat-composer-runner.jsusedquestionCount === 1as the sole condition for immediate-send, without checking themultiSelect/data-multipleflag.Export renderer: The standalone export page (
internal/ui/export/app/50-render-entry.js) had the same rendering omission.Additionally, none of the renderers emitted a free-text input row, and there was no mechanism to detect free-text option labels.
Fix
Multi-select rendering (3 files)
web/src/session/render/session-entry-renderer.jsweb/src/session/live/live-renderer.jsinternal/ui/export/app/50-render-entry.jsEach now checks
q.multiSelect === truealongside question count:isMulti = questions.length > 1 || questions.some(q => q.multiSelect === true)(for card-level)qMultiple = q.multiSelect === true(for per-questiondata-multipleattr)ask-question-multiselectclass to multi-select option elementsClick handling (
chat-composer-runner.js)questionCount === 1toquestionCount === 1 && !qMultipleoption.classList.toggle("selected").selectedoptions, joins with commaFree-text input row (same 3 renderers + chat-composer-runner)
"Type something."(pi standard)"其他","Other","自定义","Custom","自行输入","自由输入","enter your"<input>insteaddata-freetext="true"attribute on question blocks that have a freetext inputStyling (
session.css).ask-question-option.multiselect— dashed border, ☐/☑ indicators.ask-question-freetext-input— dashed border, accent focus colorTests
session-entry-renderer.test.js— 2 new test cases fordata-multipleandask-question-multiselectlive-renderer.test.js— 1 new test case for multiSelect renderingchat-composer-runner.test.js— 4 new test cases for multi-select toggle, submit, single-select guardask_user_question_render_test.go— Go embedded asset test checks fordata-multipleandask-question-multiselectTesting