Skip to content

Mirror: fix: prevent Create New Mode form fields from resetting (#5826)#34

Merged
jeremylongshore merged 1 commit intomainfrom
mirror/PR-5826
Feb 15, 2026
Merged

Mirror: fix: prevent Create New Mode form fields from resetting (#5826)#34
jeremylongshore merged 1 commit intomainfrom
mirror/PR-5826

Conversation

@jeremylongshore
Copy link
Copy Markdown
Owner

Mirror of upstream PR #5826

Verdict: APPROVE | Tier 2

Review: kilocode-5826-review.md

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 15, 2026

Warning

Rate limit exceeded

@jeremylongshore has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 26 minutes and 1 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch mirror/PR-5826

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.

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @jeremylongshore, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the user experience within the 'Create New Mode' functionality and navigation. By replacing problematic web components with native HTML elements, it eliminates frustrating form field resets during input. Additionally, it fixes a critical navigation bug that previously led to a blank screen when accessing the 'modes' tab, ensuring a smoother and more reliable user journey.

Highlights

  • Form Field Stability: Addressed an issue where 'Create New Mode' form fields would reset while typing, caused by VS Code web component re-renders.
  • Navigation Fix: Resolved a bug that resulted in a blank screen when navigating to the 'modes' tab directly from the marketplace.
  • Component Replacement: Replaced VS Code web component input fields (VSCodeTextArea, VSCodeTextField) with native HTML elements (textarea, Input) to improve stability and prevent re-render issues.
  • Tab Redirection: Implemented a redirection for the 'modes' tab, now directing users to the 'settings' tab with the 'modes' section pre-selected.
Changelog
  • .changeset/fix-create-mode-form-reset.md
    • Added a new changeset file to document the fix for form field resetting and the navigation issue.
  • webview-ui/src/App.tsx
    • Implemented a redirection for the 'modes' tab to point to the 'settings' tab, specifically opening the 'modes' section.
    • Modified the targetTab variable from const to let to allow reassignment for the redirection logic.
  • webview-ui/src/components/modes/ModesView.tsx
    • Replaced VSCodeTextArea components with native textarea elements for role definition, when-to-use, and custom instructions fields.
    • Replaced VSCodeTextField with a generic Input component for the mode description field.
    • Applied VS Code-themed Tailwind CSS classes to the new native input elements to maintain consistent styling.
Activity
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@qodo-code-review
Copy link
Copy Markdown

Review Summary by Qodo

Fix Create New Mode form fields resetting and modes tab navigation

🐞 Bug fix

Grey Divider

Walkthroughs

Description
• Replace VS Code web components with native HTML elements to prevent form field resets during
  re-renders
• Add CSS styling to native inputs for VS Code theme consistency
• Redirect "modes" tab navigation to settings with modes section selected
• Fix blank screen issue when navigating to modes tab from marketplace
Diagram
flowchart LR
  A["VS Code Web Components"] -->|"Replace with native HTML"| B["Native textarea/input elements"]
  B -->|"Add CSS styling"| C["VS Code themed inputs"]
  D["Modes tab navigation"] -->|"Redirect to settings"| E["Settings with modes section"]
  C -->|"Prevent re-renders"| F["Form fields persist while typing"]
  E -->|"Fix blank screen"| F
Loading

Grey Divider

File Changes

1. .changeset/fix-create-mode-form-reset.md 📝 Documentation +5/-0

Add changeset for form reset fix

• Add changeset entry documenting the patch version bump
• Document fix for form field resets and blank screen issues

.changeset/fix-create-mode-form-reset.md


2. webview-ui/src/App.tsx 🐞 Bug fix +7/-1

Redirect modes tab to settings view

• Redirect "modes" tab to "settings" tab with modes section selected
• Prevent blank screen when navigating to modes from marketplace
• Use let instead of const for targetTab to allow reassignment

webview-ui/src/App.tsx


3. webview-ui/src/components/modes/ModesView.tsx 🐞 Bug fix +12/-14

Replace VS Code components with native HTML elements

• Replace VSCodeTextArea components with native textarea elements in role definition, when to
 use, and custom instructions fields
• Replace VSCodeTextField with native Input component in description field
• Add comprehensive CSS styling to native elements for VS Code theme consistency (background,
 foreground, border, padding, font)
• Simplify event handler target casting by using native element properties directly

webview-ui/src/components/modes/ModesView.tsx


Grey Divider

Qodo Logo

@jeremylongshore jeremylongshore merged commit 9c70ac2 into main Feb 15, 2026
11 of 14 checks passed
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request addresses two issues: it prevents form fields in the 'Create New Mode' dialog from resetting during input, and it fixes a blank screen when navigating to the modes tab. The form reset issue is resolved by replacing VS Code's web components (VSCodeTextArea, VSCodeTextField) with native HTML elements and custom controlled components, which is a solid approach. The navigation fix correctly redirects the 'modes' tab to the appropriate section within the settings view.

My main feedback is on code duplication. The new textarea elements have a long, duplicated string of CSS classes for styling. I've suggested creating a reusable Textarea component to encapsulate these styles, improving maintainability and consistency, similar to how the Input component is already being used.

Comment on lines +1571 to 1578
<textarea
value={newModeRoleDefinition}
onChange={(e) => {
setNewModeRoleDefinition((e.target as HTMLTextAreaElement).value)
setNewModeRoleDefinition(e.target.value)
}}
rows={4}
className="w-full"
className="w-full resize-y bg-vscode-input-background text-vscode-input-foreground border border-vscode-input-border rounded p-2 font-[var(--vscode-font-family)] text-[13px]"
/>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

While replacing VSCodeTextArea with a native <textarea> is a good fix for the state reset issue, the styling is applied via a long className string that is duplicated across three text areas in this form (here, and on lines 1609 and 1655).

To improve maintainability and consistency, consider creating a reusable Textarea component in @src/components/ui that encapsulates these styles, similar to how the Input component is used. This would make the code cleaner and ensure all text areas in the form have a consistent appearance.

If the existing Textarea component in webview-ui/src/components/ui/textarea.tsx doesn't meet the styling needs, it could be updated, or a new, more specific component could be created.

@qodo-code-review
Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (1) 📎 Requirement gaps (0)

Grey Divider


Action required

1. ModesView edits lack marker 📘 Rule violation ✓ Correctness
Description
Edits in webview-ui/src/components/modes/ModesView.tsx were made without adding kilocode_change
markers around the modified blocks, increasing upstream sync merge-conflict risk. Upstream-shared
code changes under webview-ui/ must be explicitly marked.
Code

webview-ui/src/components/modes/ModesView.tsx[R1571-1578]

+								<textarea
									value={newModeRoleDefinition}
									onChange={(e) => {
-										setNewModeRoleDefinition((e.target as HTMLTextAreaElement).value)
+										setNewModeRoleDefinition(e.target.value)
									}}
									rows={4}
-									className="w-full"
+									className="w-full resize-y bg-vscode-input-background text-vscode-input-foreground border border-vscode-input-border rounded p-2 font-[var(--vscode-font-family)] text-[13px]"
								/>
Evidence
PR Compliance ID 8 requires kilocode_change markers for modifications in upstream-shared files
under webview-ui/. The changed textarea block in ModesView.tsx has no nearby kilocode_change
marker indicating this edit.

AGENTS.md
webview-ui/src/components/modes/ModesView.tsx[1571-1578]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Edits were made in an upstream-shared `webview-ui/` file without adding `kilocode_change` markers around the modified blocks.

## Issue Context
Per repo compliance rules, Kilo-specific edits in upstream-shared paths must be clearly marked to reduce merge conflicts during upstream syncs.

## Fix Focus Areas
- webview-ui/src/components/modes/ModesView.tsx[1571-1662]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Modes redirect drops section 🐞 Bug ✓ Correctness
Description
When handling action:switchTab(tab="modes"), App.tsx sets the section but then switchTab() clears it
and the handler overwrites it with message.values.section (undefined for the marketplace link).
Additionally, "modes" is not a valid SettingsView section id, so even preserving it would not show
the Modes UI.
Code

webview-ui/src/App.tsx[R178-187]

+					let targetTab = message.tab as Tab
+					// kilocode_change start - Redirect "modes" tab to settings with modes section
+					if (targetTab === "modes") {
+						targetTab = "settings"
+						setCurrentSection("modes")
+					}
+					// kilocode_change end
					// kilocode_change start - Handle auth tab with returnTo and profileName parameters
					if (targetTab === "auth") {
						if (message.values?.returnTo) {
Evidence
The new redirect sets currentSection("modes"), but switchTab() immediately clears currentSection,
and the handler then overwrites it with targetSection derived from message.values.section (missing
in the marketplace link). Separately, SettingsView only renders the Modes UI under the
"agentBehaviour" section/tab; "modes" is commented out of sectionNames and AgentBehaviourView
defaults its internal tab to "modes", so the correct targetSection should be "agentBehaviour".

webview-ui/src/App.tsx[176-202]
webview-ui/src/App.tsx[132-153]
webview-ui/src/components/marketplace/MarketplaceView.tsx[101-108]
webview-ui/src/components/settings/SettingsView.tsx[106-125]
webview-ui/src/components/settings/SettingsView.tsx[147-151]
webview-ui/src/components/settings/SettingsView.tsx[1252-1254]
webview-ui/src/components/kilocode/settings/AgentBehaviourView.tsx[43-80]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`action:switchTab` handling for `tab=&quot;modes&quot;` currently attempts to set `currentSection(&quot;modes&quot;)`, but that value is cleared by `switchTab()` and then overwritten by `setCurrentSection(message.values?.section)` (typically `undefined`). Even if it weren’t overwritten, `SettingsView` does not recognize `&quot;modes&quot;` as a valid section/tab; the Modes UI is under the `&quot;agentBehaviour&quot;` settings section.

### Issue Context
- Marketplace sends `vscode.postMessage({ type: &quot;switchTab&quot;, tab: &quot;modes&quot; })` without `values.section`.
- `switchTab()` clears `currentSection`.
- `SettingsView` only renders `AgentBehaviourView` when `activeTab === &quot;agentBehaviour&quot;`, and `AgentBehaviourView` defaults to its internal `&quot;modes&quot;` sub-tab.

### Fix Focus Areas
- webview-ui/src/App.tsx[132-153]
- webview-ui/src/App.tsx[176-202]
- webview-ui/src/components/settings/SettingsView.tsx[106-151]
- webview-ui/src/components/settings/SettingsView.tsx[1252-1254]

### Suggested approach
- In the `switchTab` action handler, introduce a local `let targetSection = message.values?.section as string | undefined`.
- If `message.tab === &quot;modes&quot;`, set `targetTab = &quot;settings&quot;` and `targetSection = &quot;agentBehaviour&quot;`.
- Call `switchTab(targetTab)` first, then `setCurrentSection(targetSection)` once (avoid setting it twice).
- Optionally: if `targetTab === &quot;settings&quot;` and `targetSection` is `&quot;modes&quot;` or `&quot;mcp&quot;`, normalize it to `&quot;agentBehaviour&quot;` to support existing senders.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

Comment on lines +1571 to 1578
<textarea
value={newModeRoleDefinition}
onChange={(e) => {
setNewModeRoleDefinition((e.target as HTMLTextAreaElement).value)
setNewModeRoleDefinition(e.target.value)
}}
rows={4}
className="w-full"
className="w-full resize-y bg-vscode-input-background text-vscode-input-foreground border border-vscode-input-border rounded p-2 font-[var(--vscode-font-family)] text-[13px]"
/>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

1. Modesview edits lack marker 📘 Rule violation ✓ Correctness

Edits in webview-ui/src/components/modes/ModesView.tsx were made without adding kilocode_change
markers around the modified blocks, increasing upstream sync merge-conflict risk. Upstream-shared
code changes under webview-ui/ must be explicitly marked.
Agent Prompt
## Issue description
Edits were made in an upstream-shared `webview-ui/` file without adding `kilocode_change` markers around the modified blocks.

## Issue Context
Per repo compliance rules, Kilo-specific edits in upstream-shared paths must be clearly marked to reduce merge conflicts during upstream syncs.

## Fix Focus Areas
- webview-ui/src/components/modes/ModesView.tsx[1571-1662]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment thread webview-ui/src/App.tsx
Comment on lines +178 to 187
let targetTab = message.tab as Tab
// kilocode_change start - Redirect "modes" tab to settings with modes section
if (targetTab === "modes") {
targetTab = "settings"
setCurrentSection("modes")
}
// kilocode_change end
// kilocode_change start - Handle auth tab with returnTo and profileName parameters
if (targetTab === "auth") {
if (message.values?.returnTo) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

2. Modes redirect drops section 🐞 Bug ✓ Correctness

When handling action:switchTab(tab="modes"), App.tsx sets the section but then switchTab() clears it
and the handler overwrites it with message.values.section (undefined for the marketplace link).
Additionally, "modes" is not a valid SettingsView section id, so even preserving it would not show
the Modes UI.
Agent Prompt
### Issue description
`action:switchTab` handling for `tab="modes"` currently attempts to set `currentSection("modes")`, but that value is cleared by `switchTab()` and then overwritten by `setCurrentSection(message.values?.section)` (typically `undefined`). Even if it weren’t overwritten, `SettingsView` does not recognize `"modes"` as a valid section/tab; the Modes UI is under the `"agentBehaviour"` settings section.

### Issue Context
- Marketplace sends `vscode.postMessage({ type: "switchTab", tab: "modes" })` without `values.section`.
- `switchTab()` clears `currentSection`.
- `SettingsView` only renders `AgentBehaviourView` when `activeTab === "agentBehaviour"`, and `AgentBehaviourView` defaults to its internal `"modes"` sub-tab.

### Fix Focus Areas
- webview-ui/src/App.tsx[132-153]
- webview-ui/src/App.tsx[176-202]
- webview-ui/src/components/settings/SettingsView.tsx[106-151]
- webview-ui/src/components/settings/SettingsView.tsx[1252-1254]

### Suggested approach
- In the `switchTab` action handler, introduce a local `let targetSection = message.values?.section as string | undefined`.
- If `message.tab === "modes"`, set `targetTab = "settings"` and `targetSection = "agentBehaviour"`.
- Call `switchTab(targetTab)` first, then `setCurrentSection(targetSection)` once (avoid setting it twice).
- Optionally: if `targetTab === "settings"` and `targetSection` is `"modes"` or `"mcp"`, normalize it to `"agentBehaviour"` to support existing senders.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

@github-actions
Copy link
Copy Markdown

Failed to generate code suggestions for PR

@jeremylongshore jeremylongshore deleted the mirror/PR-5826 branch February 15, 2026 03:12
@jeremylongshore
Copy link
Copy Markdown
Owner Author

Review Summary

Aspect Assessment
Verdict APPROVE
Confidence 5/5
Blocking Issues 0

Checklist

  • Changeset included
  • Two distinct bugs fixed
  • Native elements properly themed with VS Code CSS vars

Analysis

Fix 1: Form Reset (ModesView.tsx)

Replaces VS Code web components with native HTML elements:

  • VSCodeTextArea<textarea> (3 instances)
  • VSCodeTextField<Input> (1 instance)

VS Code web components reset their internal value on re-render. Native elements don't. Same pattern as Kilo-Org#5634.

The native elements use proper VS Code theme variables (--vscode-input-background, etc.) for visual consistency.

Fix 2: Blank Screen on Navigation (App.tsx)

Redirects "modes" tab switch to "settings" with setCurrentSection("modes"). Fixes blank screen when navigating from marketplace to modes tab — the "modes" tab doesn't exist as a standalone view, it's a section within settings.

Recommendation

APPROVE — Clean fixes for two related UX bugs. Merge.


@jeremylongshore
Copy link
Copy Markdown
Owner Author

Review Journal: kilocode Kilo-Org#5826

PR: #5826 |
Author: kiloconnect (bot) | Size: 39 lines, 3 files | Confidence: 5/5

Summary

Fixes two related UX bugs: (1) VS Code web components (VSCodeTextArea, VSCodeTextField) reset form values on re-render, replaced with native HTML elements themed with VS Code CSS variables; (2) navigating to "modes" tab showed a blank screen because it doesn't exist as a standalone view. APPROVE with changeset.

What Changed

Fix 1: Form Reset (ModesView.tsx)

Replaced 3 VSCodeTextArea instances and 1 VSCodeTextField with native <textarea> and <Input> elements. The native elements use VS Code theme variables (--vscode-input-background, --vscode-input-foreground, etc.) for visual consistency.

This is the same root cause as PR Kilo-Org#5634 — VS Code web components have internal state that conflicts with React's controlled input pattern.

Fix 2: Blank Screen Navigation (App.tsx)

When navigating from the marketplace to the "modes" tab, the app redirected to a non-existent standalone view. The fix redirects to the settings view with setCurrentSection("modes"), which renders modes as a section within settings.

Lessons Learned


Review #15 of 75 | Methodology

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant