Skip to content

🙋 feat: Refine the Ask Question Card and Smooth Batched Question Steps - #16641

Merged
berry-13 merged 20 commits into
devfrom
berry-13/ask-question-refine
Oct 2, 2026
Merged

berry-13 merged 20 commits into
devfrom
berry-13/ask-question-refine

Conversation

@berry-13

@berry-13 berry-13 commented Oct 1, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Part 2 of the ui-refinments stack (#16640 onto dev, then #16641, #16642, #16643; merge from the bottom up).

The ask question card used its own colors and spacing, a "Ctrl+Shift+X to stop" composer hint, and an "Asking N questions" label above the question, and stepping through a batch of questions animated every title, option and input while the header and buttons slid with the height. The card now sits on surface-secondary, puts the question title in the header row, uses the standard Input for typed answers and the numbered option rows from the composer, and the stop hint is gone. Switching questions swaps the content instantly while only the card's outer height eases, with the header and footer pinned to the card edges.

Option rows are a new option Button variant: instant hover, a slow fade when they lock, and a check mark on the chosen single-select answer. Typing an answer deselects and locks that question's options. While the question is inline in the thread, the locked composer drops the "Set your key" placeholder and its text cannot be selected; Back, Next and option labels cannot be text-selected either. The move-to-chat chevron rotates during the composer and chat morph. A disclosure Button variant replaces the restyled header button in ProgressText.

Type of change

  • Feature
  • Bug fix

Testing

Tested environments/configuration:

  • Browser: Chromium (Playwright) against a local dev server, light and dark mode
  • Data: a seeded live batch question part (single-select, multi-select and free-text questions)
  • Frame-sampled the card height across question switches to confirm one continuous ease with a fixed header and footer

Automated tests:

  • npx jest --findRelatedTests on the changed files, including new Button.spec.tsx cases for the option and disclosure variants and an AutoHeight spec
  • npx tsc --noEmit -p client/tsconfig.json, ESLint, Prettier, npm run static-checks

Screenshots / recordings

Captured from the e2e mock harness at 1280x800 against the client built before and after this PR.

Before After
Text answer, light Before After
Option rows, light Before After
Text answer, dark Before After
Option rows, dark Before After

Risk / compatibility

Removes the com_ui_composer_hint_stop, com_ui_question_number, com_ui_asking_questions and com_ui_asking_questions_one English keys, which nothing references after this change. The stop shortcut itself still works.

Checklist

  • I reviewed my own changes
  • Relevant tests have been added or updated
  • Existing relevant tests pass
  • The change does not introduce new warnings or errors

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-02T20:53:02.597213Z dbc0db8 New commits
🔒 Security Review ✅ Completed 2026-10-01T22:20:45.528128Z 063719a PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 063719a0d3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 46 to 49
selected:
question.multiSelect === true || value.length === 0
value.trim().length === 0
? previous.selected
: { ...previous.selected, [question.id]: [] },

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Migrate the touched batch form atom to Jotai

This changes how the existing askQuestionsFormState is written when users type answers, so the atom is now part of the touched feature area, but it remains a Recoil atomFamily. Convert this atom and all of its readers/writers together to Jotai rather than extending behavior on the legacy store.

AGENTS.md reference: AGENTS.md:L161-L164

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 1dc826e: the batch form state is now a Jotai atomFamily owned by useAskQuestionsForm, its only reader and writer. Popover and chat card share it, verified by scenario ask-batch-answers-survive-move-to-chat.

Comment on lines +56 to +57
<div className="absolute bottom-full z-10 mb-2 w-full">
<div className="popover border-border-light bg-surface-secondary flex flex-col rounded-2xl border shadow-lg [view-transition-name:ask-question]">

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep long batch prompts within the viewport

When a valid batch contains a long question or description, this absolutely positioned, bottom-anchored popover can grow upward beyond the viewport because the overall max-h-[70vh] cap was removed and only the answer area is scrollable. The backend permits up to 2,000 question characters plus a 4,000-character description, so the prompt can become unreadable above the viewport with no way to scroll to it; retain a viewport cap and put the prompt in a bounded scroll region.

AGENTS.md reference: AGENTS.md:L49-L52

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 1dc826e: the prompt block is capped at 25vh with its own scroll. Verified with a 2,000-character question plus 4,000-character description by scenario ask-batch-long-prompt-fits-viewport.

className="flex flex-col"
/>
)}
<Input

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Prevent Enter in batch answers from submitting the chat form

In the composer popover, this single-line Input is nested inside ChatForm's outer <form>, so Enter performs implicit form submission rather than editing or confirming the batch answer. When the paused conversation already has composer text, the enabled during-run submit control receives that implicit submission and routes the unrelated composer draft through the queue/send path, while this answer is not registered with that form; prevent the outer submission or explicitly handle Enter for the batch field.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 1dc826e: Enter in a batch answer field is handled there (next question, or submit on the last) and never reaches the chat form. Verified by scenario ask-batch-enter-confirms-answer, which asserts no new generation starts and the resume carries all three answers.

Comment on lines +172 to +173
option:
'w-full select-none justify-start gap-2.5 whitespace-normal text-left font-normal text-text-primary transition-opacity enabled:duration-500 disabled:duration-500 disabled:transition-all hover:bg-surface-hover hover:active:bg-surface-pressed data-[selected=true]:bg-surface-active data-[selected=true]:hover:bg-surface-active',

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Disable the option fade for reduced-motion users

When prefers-reduced-motion: reduce is enabled, locking or unlocking an option still runs the newly added 500 ms opacity/color transition because this variant has no motion-reduce override. Add a reduced-motion transition override so the shared option variant does not animate for users who requested less motion.

AGENTS.md reference: AGENTS.md:L150-L151

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 1dc826e: the option variant adds motion-reduce:transition-none, including for disabled rows. Verified by scenario ask-option-rows-skip-fade-under-reduced-motion.

@codegraph-librechat codegraph-librechat Bot added the 🗺️ Agent Chat UI codegraph: the taxonomy area this belongs to (classifier, confidence ≥ 0.9) label Oct 1, 2026
@berry-13
berry-13 force-pushed the berry-13/ask-question-refine branch from 063719a to f34db3d Compare October 2, 2026 14:27
Copilot AI balanced review requested due to automatic review settings October 2, 2026 14:27
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

Base automatically changed from berry-13/chat-output-polish to dev October 2, 2026 16:24
@berry-13
berry-13 force-pushed the berry-13/ask-question-refine branch from 5c413df to 14cdb71 Compare October 2, 2026 16:24

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 14cdb71175

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

<div className="absolute bottom-full z-10 mb-2 w-full">
{/* The prompt and answers each scroll within their own caps; this outer cap keeps
the whole card on screen when both are at their limit on a short viewport. */}
<div className="popover border-border-light bg-surface-secondary flex max-h-[70vh] flex-col overflow-y-auto rounded-2xl border shadow-lg [view-transition-name:ask-question]">

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Let the capped batch card actually overflow

For a valid batch where the prompt reaches its 25vh cap and several long options make the answer region reach 45vh, those regions plus the nonshrinking footer exceed this 70vh wrapper. The current AskUserQuestions child is allowed to shrink (min-h-0), and its AutoHeight child uses overflow-hidden, so flex layout clips the bottom of the answer region rather than creating overflow for this wrapper to scroll; the final options or text input can therefore remain unreachable. Fresh evidence beyond the earlier long-prompt thread is the current combination of this outer cap with the shrinking, clipping AutoHeight; make that content nonshrinking or put the scroll boundary outside the clipping element.

AGENTS.md reference: AGENTS.md:L49-L52

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in cb61b3a: the batch card is shrink-0 inside the 70vh popover, so the popover scrolls instead of AutoHeight clipping the answers. Scenario ask-batch-long-prompt-fits-viewport now uses six long options and asserts the answer field is reachable; it fails without the fix and passes with it.

Comment on lines +218 to +220
if (!isLastStep) {
if (!navLocked) {
goToStep(activeIndex + 1);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve focus after Enter advances to the next question

When a keyboard user presses Enter in a non-final answer field, changing the step replaces the keyed fieldset and unmounts the focused input. Fresh evidence after the earlier Enter fix is that this branch calls goToStep without setting refocusRef, unlike the single-select option path, so the step-change effect does not focus the new fieldset and focus falls back to the document body; the next Tab can restart at page chrome instead of the next answer. Set the refocus signal or explicitly focus the new answer before advancing.

AGENTS.md reference: AGENTS.md:L199-L204

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in cb61b3a: Enter sets the refocus signal before advancing, so the next question's fieldset takes focus, the same as option selection. Covered by a unit test in AskUserQuestions.test.tsx.

Comment on lines +214 to +215
if (event.key !== 'Enter' || event.nativeEvent.isComposing) {
return;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Ignore IME confirmation Enter before advancing

On browsers where confirming an IME composition reports key === 'Enter' and keyCode === 229 while nativeEvent.isComposing is already false, this handler advances the step or submits the batch with incomplete CJK input. Fresh evidence after the earlier Enter thread is that the new handler omits the Safari/IME fallback already required by useAskAnswerMode and useTextarea; apply the same keyCode === 229 guard before treating Enter as confirmation.

AGENTS.md reference: AGENTS.md:L199-L204

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in cb61b3a: the handler ignores keyCode 229 like useAskAnswerMode, so an Enter that confirms an IME composition neither advances nor submits. Covered by a unit test.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cb61b3ab96

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread client/src/components/Chat/Input/AskUserQuestionPopover.tsx
@berry-13
berry-13 force-pushed the berry-13/ask-question-refine branch from cb61b3a to dbc0db8 Compare October 2, 2026 20:47
@berry-13
berry-13 merged commit fc05ea3 into dev Oct 2, 2026
43 checks passed
@berry-13
berry-13 deleted the berry-13/ask-question-refine branch October 2, 2026 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🗺️ Agent Chat UI codegraph: the taxonomy area this belongs to (classifier, confidence ≥ 0.9)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants