Skip to content

feat(shared-ui): add variable picker affordance to config fields#1276

Draft
dsapandora wants to merge 1 commit into
developfrom
feat/config-field-variable-picker
Draft

feat(shared-ui): add variable picker affordance to config fields#1276
dsapandora wants to merge 1 commit into
developfrom
feat/config-field-variable-picker

Conversation

@dsapandora

@dsapandora dsapandora commented Jun 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Make Variables discoverable: add a small ${} button to the config field widgets (BaseInputTemplate, TextareaWidget) that opens the list of saved variables — no need to know the ${...} syntax or ROCKETRIDE_ prefix.
  • Selecting one inserts ${ROCKETRIDE_NAME} at the cursor, reusing the existing suggestion list and insert logic (new openAll on useEnvVarAutocomplete).
  • Shown only when variables exist (envKeys) and the field is editable. Works in web and VS Code (shared widgets).

Type

feat

Testing

  • Tests added or updated
  • Tested locally
  • ./builder test passes

Checklist

  • Commit messages follow conventional commits
  • No secrets or credentials included
  • Wiki updated (if applicable)
  • Breaking changes documented (if applicable)

Linked Issue

Fixes #1275

Summary by CodeRabbit

Release Notes

  • New Features
    • Added environment variable picker buttons to text input and textarea fields. Users can now quickly access the full list of available variables with a single click when the fields are editable and variables are configured.

@github-actions

Copy link
Copy Markdown
🤖 Internal: Discord sync marker

Auto-managed by the Discord notification workflow. Stores the linked Discord message ID. Do not edit or delete.

@coderabbitai

coderabbitai Bot commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Draft detected.

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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: e54c6a93-7ab9-4ec9-ad27-b6d0a45c4e5d

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:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds a ${} end-adornment icon button to BaseInputTemplate and TextareaWidget that opens the env-var suggestions popover with all available variables at the current cursor position. The useEnvVarAutocomplete hook gains a new openAll method to support this trigger path, bypassing the ${ keystroke requirement.

Changes

Variable Picker Affordance

Layer / File(s) Summary
openAll method on useEnvVarAutocomplete
...hooks/useEnvVarAutocomplete.ts
UseEnvVarAutocompleteResult interface gains openAll(anchorElement, cursorPos). The implementation sets triggerStartRef to cursorPos, populates suggestions with all envKeys, anchors the popover, resets the highlight index, and sets isOpen to true. The function is included in the hook's return object.
${} picker button in BaseInputTemplate
...base-input-template/BaseInputTemplate.tsx
Imports InputAdornment and IconButton. Adds handleOpenPicker (focuses input, calls openAll at current selection) and showVarPicker gate (envKeys present and field not disabled/readonly). TextField conditionally receives an end-adornment ${} button; otherwise forwards existing textFieldProps.endAdornment.
${} picker button in TextareaWidget
...textarea-widget/TextareaWidget.tsx
Mirrors the BaseInputTemplate changes: same MUI imports, handleOpenPicker callback, showVarPicker flag, and conditional end-adornment ${} button on the TextField.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 No more guessing, no more ${ to type,
A little button glows at the field's right side,
Click it once and all your secrets arrive,
The rabbit hops in — variables thrive!
${} for all, with a wiggle of pride! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding a variable picker button to config field widgets to improve discoverability of the Variables feature.
Linked Issues check ✅ Passed The PR implements all coding requirements from issue #1275: adds variable picker affordances to BaseInputTemplate and TextareaWidget, uses openAll() to show all variables, inserts ${ROCKETRIDE_NAME} syntax, and shows the button only when variables exist and fields are editable.
Out of Scope Changes check ✅ Passed All changes are scoped to the stated objectives: adding the variable picker button to config fields and exposing the openAll() function in useEnvVarAutocomplete to support the new affordance.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/config-field-variable-picker

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 and usage tips.

@github-actions github-actions Bot added the module:ui Chat UI and Dropper UI label Jun 14, 2026

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@packages/shared-ui/src/components/canvas/components/rjsf-widgets/base-input-template/BaseInputTemplate.tsx`:
- Around line 214-220: The picker IconButton components are set to
tabIndex={-1}, which removes them from keyboard navigation and makes them
inaccessible to keyboard-only users. Remove the tabIndex={-1} attribute from the
picker IconButton in
packages/shared-ui/src/components/canvas/components/rjsf-widgets/base-input-template/BaseInputTemplate.tsx
(lines 214-220) with the aria-label "Insert variable", and apply the same fix by
removing tabIndex={-1} from the picker IconButton in
packages/shared-ui/src/components/canvas/components/rjsf-widgets/textarea-widget/TextareaWidget.tsx
(lines 110-116). This will allow both picker buttons to participate in the
normal tab order and be discoverable to keyboard users.

In
`@packages/shared-ui/src/components/canvas/components/rjsf-widgets/hooks/useEnvVarAutocomplete.ts`:
- Around line 115-128: The new openAll callback function in the
useEnvVarAutocomplete hook introduces a second code path for handling
environment variable autocomplete insertion (cursor-position based insertion
without requiring the ${ prefix). Add test cases in the hook tests or widget
tests that specifically validate this openAll behavior, including tests that
confirm the triggerStartRef is correctly set to the cursor position, that
setSuggestions populates with envKeys, that setIsOpen sets the popover to open
state, and that setHighlightedIndex initializes to 0. These tests should cover
the insertion semantics when openAll is called with a valid anchorElement and
cursorPos to ensure this alternative entry path works correctly alongside the
existing trigger-based path.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 05b88e22-d948-46e0-8c5c-09f934c3a9c8

📥 Commits

Reviewing files that changed from the base of the PR and between 34b6f6a and 03730e8.

📒 Files selected for processing (3)
  • packages/shared-ui/src/components/canvas/components/rjsf-widgets/base-input-template/BaseInputTemplate.tsx
  • packages/shared-ui/src/components/canvas/components/rjsf-widgets/hooks/useEnvVarAutocomplete.ts
  • packages/shared-ui/src/components/canvas/components/rjsf-widgets/textarea-widget/TextareaWidget.tsx

Comment on lines +214 to +220
<IconButton
size="small"
edge="end"
tabIndex={-1}
aria-label="Insert variable"
title="Insert variable"
onClick={handleOpenPicker}

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.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Shared root cause: picker affordance is excluded from keyboard navigation via tabIndex={-1}. This defeats the discoverability fix for keyboard-only users in both widgets.

  • packages/shared-ui/src/components/canvas/components/rjsf-widgets/base-input-template/BaseInputTemplate.tsx#L214-L220: remove tabIndex={-1} from the picker IconButton so it participates in tab order.
  • packages/shared-ui/src/components/canvas/components/rjsf-widgets/textarea-widget/TextareaWidget.tsx#L110-L116: apply the same change to the textarea picker IconButton.
📍 Affects 2 files
  • packages/shared-ui/src/components/canvas/components/rjsf-widgets/base-input-template/BaseInputTemplate.tsx#L214-L220 (this comment)
  • packages/shared-ui/src/components/canvas/components/rjsf-widgets/textarea-widget/TextareaWidget.tsx#L110-L116
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/shared-ui/src/components/canvas/components/rjsf-widgets/base-input-template/BaseInputTemplate.tsx`
around lines 214 - 220, The picker IconButton components are set to
tabIndex={-1}, which removes them from keyboard navigation and makes them
inaccessible to keyboard-only users. Remove the tabIndex={-1} attribute from the
picker IconButton in
packages/shared-ui/src/components/canvas/components/rjsf-widgets/base-input-template/BaseInputTemplate.tsx
(lines 214-220) with the aria-label "Insert variable", and apply the same fix by
removing tabIndex={-1} from the picker IconButton in
packages/shared-ui/src/components/canvas/components/rjsf-widgets/textarea-widget/TextareaWidget.tsx
(lines 110-116). This will allow both picker buttons to participate in the
normal tab order and be discoverable to keyboard users.

Comment on lines +115 to +128
const openAll = useCallback(
(anchorElement: HTMLElement | null, cursorPos: number) => {
if (!anchorElement || !envKeys.length) return;
// No `${` was typed — insert at the current cursor position. handleSelect
// replaces from triggerStart to the cursor, so a zero-width range there
// just inserts `${KEY}` without clobbering surrounding text.
triggerStartRef.current = cursorPos;
setSuggestions(envKeys);
setAnchorEl(anchorElement);
setHighlightedIndex(0);
setIsOpen(true);
},
[envKeys],
);

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.

🧹 Nitpick | 🔵 Trivial | ⚡ Quick win

Add focused tests for the new openAll insertion path.

openAll introduces a second entry path into selection/insertion semantics. Add hook/widget tests that validate cursor-position insertion and popover open state so regressions don’t slip in.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/shared-ui/src/components/canvas/components/rjsf-widgets/hooks/useEnvVarAutocomplete.ts`
around lines 115 - 128, The new openAll callback function in the
useEnvVarAutocomplete hook introduces a second code path for handling
environment variable autocomplete insertion (cursor-position based insertion
without requiring the ${ prefix). Add test cases in the hook tests or widget
tests that specifically validate this openAll behavior, including tests that
confirm the triggerStartRef is correctly set to the cursor position, that
setSuggestions populates with envKeys, that setIsOpen sets the popover to open
state, and that setHighlightedIndex initializes to 0. These tests should cover
the insertion semantics when openAll is called with a valid anchorElement and
cursorPos to ensure this alternative entry path works correctly alongside the
existing trigger-based path.

@dsapandora dsapandora marked this pull request as draft June 14, 2026 19:17
@dsapandora dsapandora force-pushed the feat/config-field-variable-picker branch from 03730e8 to 563271d Compare June 14, 2026 19:52
Saved variables were only discoverable by typing ${ — the env-var suggestion popover never appeared otherwise. Add a small ${} button to the config field widgets (BaseInputTemplate, TextareaWidget, ApiKeyWidget) that opens the full list of saved variables and inserts ${ROCKETRIDE_NAME} on select, reusing the existing suggestion list and insert logic.

On ApiKeyWidget the button shows only while the field is editable (an existing key stays masked + read-only until cleared via the trash button). Shown only when variables exist (envKeys). Works in web and VS Code since the widgets are shared.
@dsapandora dsapandora force-pushed the feat/config-field-variable-picker branch from 563271d to 4010043 Compare June 15, 2026 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module:ui Chat UI and Dropper UI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make Variables discoverable: add a variable picker affordance to config fields

1 participant