Skip to content

[fix]: Make elicitation form keyboard shortcuts work on appearance#5307

Open
ashrafchowdury wants to merge 2 commits into
big-agentsfrom
fix-elicitation-key-shortcut
Open

[fix]: Make elicitation form keyboard shortcuts work on appearance#5307
ashrafchowdury wants to merge 2 commits into
big-agentsfrom
fix-elicitation-key-shortcut

Conversation

@ashrafchowdury

Copy link
Copy Markdown
Contributor

Context

In the agent playground, when a "request input" form appeared, the keyboard shortcuts it advertised did nothing until you clicked into the form. Focus stayed on the chat composer, so digits, arrows, and Enter never reached the form. Three smaller issues rode along: the hints always showed the Mac glyph even on Windows/Linux, there was no way to submit or advance with the keyboard at all, and in a choice-card question Enter selected a normal option but was a dead key on the free-text "Other" option.

Root cause of the main bug: the stepper's focus effect seeded its "did the step change?" ref to the current step, so its own guard skipped the very first run. The form never claimed focus when it mounted.

Changes

Focus on appearance. The stepper focus effect now seeds prevStepRef to -1 so it fires when the stepper first becomes active, moving focus onto the answer surface. Keystrokes land with no extra click. This is scoped to stepper mode; other SchemaForm consumers are untouched.

Platform-correct modifier. A new useModifierKey hook renders on macOS and Ctrl elsewhere. The hints read ⌘ ↵ / Ctrl ↵ accordingly instead of a hardcoded .

Submit and advance from the keyboard. ⌘/Ctrl + Enter now runs the primary action (Next in a stepper, Accept otherwise). A capture handler on the widget root also stops that combo from reaching the chat composer's send, and guards against key-repeat.

Hints shown only when they work. The shortcut row appears when the shortcut can actually fire: in a stepper (auto-focused on appear) or in any form once the user focuses it. Before, the row was gated on stepper-only state, so a plain form never advertised its accept shortcut.

Before: hints hidden until you happened to focus a stepper; shown on every platform.
After: hints appear the moment the form owns focus, labeled with the right modifier key.

"Other" option parity. In a choice-card question the "Other" tile now matches a normal card. Enter or Space on the focused Other card jumps into its text input, and Enter inside the single-select Other input confirms the typed value the same way picking a listed card does. Previously the Other card had no key handler and the single-select input wired onPressEnter only for multi-select, so Enter did nothing.

Tests / notes

  • Added a Playwright acceptance spec (STEPPER_ELICITATION_PAYLOAD) that drives a choice-card stepper end to end: focus on appear, digit pick, ⌘/Ctrl → paging, and ⌘/Ctrl + Enter through to submit.
  • pnpm lint-fix passes clean across the web workspace.
  • Plain Enter selects but does not page the stepper forward, by design (in chat, Enter means send). Advancing is ⌘/Ctrl + Enter or ⌘/Ctrl + →.
  • The new spec covers the stepper path only. The non-stepper "hint appears on focus" path is not yet asserted.

What to QA

  • Open the agent playground and trigger a request-input form that renders as a stepper.
  • Press ⌘/Ctrl + → to page forward and ⌘/Ctrl + Enter to advance and finally submit. The answers post back to the chat.
  • On a choice-card question, select "Other", type a value, and press Enter. The Other option stays selected and the value is confirmed (it no longer feels like a dead key). Regression: pressing Enter on a normal card still selects it.
  • On Windows or Linux, the shortcut hints read Ctrl ..., not ⌘ ....
  • Open a plain (non-stepper) request-input form. No shortcut hint shows until you click into a field, then Ctrl/⌘ ↵ accept appears.

Preview

https://jam.dev/c/01645eb8-1b53-43b0-a272-bc2f90efb007

image

@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Jul 14, 2026
@vercel

vercel Bot commented Jul 14, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agenta-documentation Ready Ready Preview, Comment Jul 14, 2026 12:44pm

Request Review

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e5bebc75-f9df-46e9-8e61-48df383f9106

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • ✅ Review completed - (🔄 Check again to review again)
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-elicitation-key-shortcut

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai 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.

🧹 Nitpick comments (1)
web/oss/src/components/AgentChatSlice/components/clientTools/ElicitationWidget.tsx (1)

126-127: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Shorten inline comments to comply with coding guidelines.

Several comments span multiple lines, which conflicts with the guideline to keep in-code comments to one short line maximum unless a genuinely surprising constraint requires a brief exception. Please consider shortening these comments to maintain consistency with the project standards. As per coding guidelines: "Keep in-code comments to one short line maximum unless a genuinely surprising constraint requires a brief exception."

  • web/oss/src/components/AgentChatSlice/components/clientTools/ElicitationWidget.tsx#L126-L127: Shorten to a single line, e.g., // Track focus inside the widget to conditionally show the ⌘↵ shortcut hint.
  • web/oss/src/components/AgentChatSlice/components/clientTools/ElicitationWidget.tsx#L347-L348: Shorten to {/* Show ⌘↵ when focused or in a stepper; paging/pick hints are stepper-only. */}
  • web/packages/agenta-entity-ui/src/gatewayTool/components/SchemaForm.tsx#L125-L126: Shorten to // Focus the answer surface on step change so advertised shortcuts work immediately.
  • web/packages/agenta-entity-ui/src/gatewayTool/components/SchemaForm.tsx#L857-L858: Shorten to // Jump into the input on Enter/Space, ignoring keys bubbling up from the input itself.
  • web/packages/agenta-entity-ui/src/gatewayTool/components/SchemaForm.tsx#L897-L898: Shorten to // Prevent the stepper's Enter-advance from firing on a chip commit.
  • web/packages/agenta-entity-ui/src/gatewayTool/components/SchemaForm.tsx#L902-L904: Shorten to // Trim and auto-advance for single-select parity with listed cards.

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: efc4f27e-74db-4675-99c6-cbc301a28f90

📥 Commits

Reviewing files that changed from the base of the PR and between 5605cc2 and 2f5764a.

📒 Files selected for processing (4)
  • web/oss/src/components/AgentChatSlice/components/clientTools/ElicitationWidget.tsx
  • web/oss/tests/playwright/acceptance/agent-chat/assets/elicitationStream.ts
  • web/oss/tests/playwright/acceptance/agent-chat/index.ts
  • web/packages/agenta-entity-ui/src/gatewayTool/components/SchemaForm.tsx

@github-actions

Copy link
Copy Markdown
Contributor

Railway Preview Environment

Preview URL https://gateway-production-05dd.up.railway.app/w
Project agenta-oss-pr-5307
Image tag pr-5307-52eff06
Status Deployed
Railway logs Open logs
Workflow logs View workflow run
Updated at 2026-07-14T13:01:58.012Z

@ashrafchowdury
ashrafchowdury requested a review from ardaerzin July 14, 2026 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Frontend size:M This PR changes 30-99 lines, ignoring generated files. UX

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] Keyboard shortcut hints don’t work in request_input component

1 participant