Skip to content

TUI: dialog-theme-list changes theme live on navigate/filter #56147

Open

Description

@Addin

Summary

dialog-theme-list.tsx calls themes.set() live during onMove and onFilter — navigating or filtering the theme list changes your theme immediately with no way to preview without committing.

Root cause

packages/tui/src/component/dialog-theme-list.tsx:29,46:

onMove={(opt) => {
  themes.set(opt.value)  // <-- changes theme immediately on hover/move
}}
onFilter={(query) => {
  if (query.length === 0) {
    themes.set(initial)  // <-- reverts theme on filter clear
    return
  }
  const first = ref.filtered[0]
  if (first) themes.set(first.value)  // <-- changes theme on filter
}}

Suggested fix

Only apply the theme on onSelect (confirmation), not during navigation/filtering. Allow preview without commitment.

Activity

  1. opencode-agent commented on Oct 16, 2026

    @opencode-agent
    Contributor

    Thanks for the report, @Addin!

    The live theme change while you move through or filter the list is meant to be a preview. When the dialog closes without a selection (e.g. you press Esc), dialog-theme-list.tsx puts your original theme back in its onCleanup handler (if (!confirmed) themes.set(initial)). So you should be able to preview themes without committing to one.

    To work out whether something isn't behaving as intended, could you tell us:

    • Your OpenCode version (opencode --version), OS and terminal
    • The exact steps you took (e.g. open the theme list, move to another theme, press Esc)
    • What you expected and what actually happened. For example, did the previewed theme stay active or stay saved in your config after you cancelled the dialog, or after a restart?

    You can reply here with the details, or edit the issue. If you edit it, please also leave a comment saying you've updated it so we know you're done editing.

  2. Addin commented on Oct 16, 2026

    @Addin
    Author

    Thank you for the detailed response. I understand the intent - live theme change as a preview, with onCleanup reverting if not confirmed.

    However, I still consider this a UX issue for the following reasons:

    1. Surprising behavior during navigation: When a user opens the theme list to browse available themes, simply moving up/down with arrow keys changes their active theme immediately. This means the entire TUI theme changes as they arrow through the list, which is disruptive and disorienting. Users expect to preview a theme before applying it, not have it applied automatically on every arrow key press.

    2. No way to preview without committing: While onCleanup reverts on dialog close without confirmation, there's no intermediate state where the user can see what a theme looks like without it being applied. The current behavior forces a commitment on every navigation step.

    3. Inconsistent with other dialogs: Other selection dialogs in the TUI (model, agent, variant, skills) don't change state on navigation - they only apply changes on explicit selection.

    Suggested fix: Only call themes.set() on onSelect (confirmation), not on onMove or onFilter. The onFilter could show a preview of filtered results without changing the theme, and onMove could highlight without applying.

    I'll keep this issue open as a UX improvement request.

  3. opencode-agent commented on Oct 16, 2026

    @opencode-agent
    Contributor

    Thanks for explaining, @Addin. That makes sense.

    To restate the request: in the theme list, moving with the arrow keys or filtering should only highlight a theme, and the theme should change only when you confirm a selection, like the model, agent and variant dialogs. The full-TUI live preview can be disorienting when you just want to browse.

    I've marked this as a feature request. Maintainers will consider it, for example whether to drop the live preview or make it optional. Thanks for the clear write-up!

  4. ColonelToad commented on Nov 1, 2026

    @ColonelToad

    I'd like to work on this. The current behavior is themes.set() in both onMove and onFilter in dialog-theme-list.tsx, plus an onCleanup that restores initial on cancel, so browsing the list writes kv.json on every arrow key. DialogSelect already tracks its own highlighted row and accepts current, so the fix is to drop those three calls and apply the theme only in onSelect: Esc then closes without writing anything, and Enter applies the highlighted theme, the same as the model, agent and variant dialogs. That removes the live preview on purpose, per the earlier reply. I'll add a test that moving and cancelling leaves the theme unchanged and that confirming applies it. This stays inside the dialog and doesn't touch the external-config hot reload in #37423. Unless there's any objections, I'll open a PR against dev.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions