Repository navigation
🙋 feat: Refine the Ask Question Card and Smooth Batched Question Steps #16641
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
f1b5202
81c4530
c9f98c8
708eea3
a124f04
c84eee3
561c75d
7405e09
85987cd
06b2a20
98efae2
8ba6167
3095b73
dd49b62
fa8ed78
68eb900
ffd22b2
50bc54b
18ffc96
dbc0db8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,45 +46,53 @@ function AskUserQuestionPopoverContent({ | |
| } | ||
|
|
||
| function AskUserQuestionsPopoverPanel({ ask }: { ask: ReturnType<typeof useAskAnswerMode> }) { | ||
| const localize = useLocalize(); | ||
| const { liveAsk, collapse } = ask; | ||
| const questions = liveAsk?.questions; | ||
| if (liveAsk == null || questions == null || questions.length === 0) { | ||
| return null; | ||
| } | ||
|
|
||
| return ( | ||
| <div className="absolute bottom-28 z-10 w-full"> | ||
| <div className="popover border-border-light bg-surface-primary-alt flex max-h-[70vh] flex-col rounded-2xl border shadow-lg"> | ||
| <div className="border-border-light flex shrink-0 items-center justify-between gap-2 border-b px-3 py-2"> | ||
| <p className="text-text-primary text-sm font-medium"> | ||
| {localize( | ||
| questions.length === 1 ? 'com_ui_asking_questions_one' : 'com_ui_asking_questions', | ||
| { 0: questions.length }, | ||
| )} | ||
| </p> | ||
| <TooltipAnchor | ||
| description={localize('com_ui_ask_move_to_chat')} | ||
| side="top" | ||
| render={ | ||
| <Button | ||
| variant="ghost" | ||
| size="icon" | ||
| aria-label={localize('com_ui_ask_move_to_chat')} | ||
| className="text-text-secondary size-auto rounded-md p-1" | ||
| onClick={collapse} | ||
| > | ||
| <ChevronDown className="size-4" aria-hidden="true" /> | ||
| </Button> | ||
| } | ||
| /> | ||
| </div> | ||
| <AskUserQuestions actionId={liveAsk.actionId} questions={questions} /> | ||
| <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]"> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
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 AGENTS.md reference: AGENTS.md:L49-L52 Useful? React with 👍 / 👎.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
| {/* Kept at full height so the cap above scrolls it rather than clipping its end. */} | ||
| <AskUserQuestions | ||
| actionId={liveAsk.actionId} | ||
| questions={questions} | ||
| className="shrink-0" | ||
| headerAction={<MoveToChatButton onClick={collapse} />} | ||
| /> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| /** Moves the question to the chat card and hands the composer back. */ | ||
| function MoveToChatButton({ onClick }: { onClick: () => void }) { | ||
| const localize = useLocalize(); | ||
| return ( | ||
| <TooltipAnchor | ||
| description={localize('com_ui_ask_move_to_chat')} | ||
| side="top" | ||
| render={ | ||
| <Button | ||
| variant="row-action" | ||
| size="icon-xs" | ||
| aria-label={localize('com_ui_ask_move_to_chat')} | ||
| onClick={onClick} | ||
| > | ||
| <ChevronDown | ||
| className="size-4 [view-transition-name:ask-question-chevron]" | ||
| aria-hidden="true" | ||
| /> | ||
| </Button> | ||
| } | ||
| /> | ||
| ); | ||
| } | ||
|
|
||
| /** | ||
| * Split from the gate above so the per-keystroke `useWatch` subscription only | ||
| * exists while the popover is actually visible — the invisible popover was | ||
|
|
@@ -149,18 +157,18 @@ function AskUserQuestionPopoverPanel({ | |
| const composerHasText = composerText.trim().length > 0; | ||
|
|
||
| return ( | ||
| <div className="absolute bottom-28 z-10 w-full space-y-2"> | ||
| <div className="absolute bottom-full z-10 mb-2 w-full"> | ||
| {/* Digit shortcuts (1..N) work when focus is inside the popover too, not | ||
| only from the composer — keydown bubbles here from the focused row/ | ||
| control. Height is viewport-bounded with the option list as the only | ||
| scroll region: the panel is absolutely positioned, so anything that | ||
| overflows it is unreachable by page scroll. */} | ||
| <div | ||
| className="popover border-border-light bg-surface-primary-alt flex max-h-[60vh] flex-col rounded-2xl border p-2 shadow-lg [view-transition-name:ask-question]" | ||
| className="popover border-border-light bg-surface-secondary flex max-h-[60vh] flex-col rounded-2xl border p-2 shadow-lg [view-transition-name:ask-question]" | ||
| onKeyDown={handlePopoverKeyDown} | ||
| > | ||
| <div className="flex shrink-0 items-start justify-between gap-2 p-2"> | ||
| <div className="max-h-[24vh] min-w-0 overflow-y-auto"> | ||
| <div className="text-text-secondary flex shrink-0 items-start justify-between gap-2 p-1 pl-2"> | ||
| <div className="max-h-[24vh] min-w-0 overflow-y-auto pt-1"> | ||
| <p className="text-text-primary text-sm font-medium [overflow-wrap:anywhere]"> | ||
| {liveAsk.question.question} | ||
| </p> | ||
|
|
@@ -170,23 +178,7 @@ function AskUserQuestionPopoverPanel({ | |
| </p> | ||
| )} | ||
| </div> | ||
| {/* Single exit: moves the question to the chat card and hands the | ||
| composer back for normal messages. */} | ||
| <TooltipAnchor | ||
| description={localize('com_ui_ask_move_to_chat')} | ||
| side="top" | ||
| render={ | ||
| <Button | ||
| variant="ghost" | ||
| size="icon" | ||
| aria-label={localize('com_ui_ask_move_to_chat')} | ||
| className="text-text-secondary size-auto rounded-md p-1" | ||
| onClick={collapse} | ||
| > | ||
| <ChevronDown className="size-4" aria-hidden="true" /> | ||
| </Button> | ||
| } | ||
| /> | ||
| <MoveToChatButton onClick={collapse} /> | ||
| </div> | ||
| <AskOptions | ||
| options={options} | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.