Skip to content

fix(app): paste plain text when renaming session tabs - #58036

Merged
Brendonovich merged 2 commits into
devfrom
fix/tab-title-plain-paste
Oct 22, 2026
Merged

Brendonovich merged 2 commits into
devfrom
fix/tab-title-plain-paste

Conversation

@opencode-agent

@opencode-agent opencode-agent Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Renaming a session tab uses a contenteditable span. With contenteditable="true", pasting text copied from a message kept its HTML, so the title showed the source's highlight/formatting while editing. The saved title was already plain text (textContent), so this was cosmetic.

The span now uses contenteditable="plaintext-only", so pastes, drops and formatting shortcuts insert plain text only.

Two selectors that detect an editing tab title matched only [contenteditable="true"]. They now also match plaintext-only, so tab drag stays disabled while editing and the document search keydown handlers still ignore keystrokes in the title. isEditableTarget in command.tsx already uses isContentEditable, which covers both.

How did you verify your code works?

  • bun run typecheck in packages/app
  • Updated three e2e locators that matched the editor by contenteditable="true". tabs.spec.ts and session-header.spec.ts now pass in built mode (33/33).
  • Playwright/Chromium: copied a highlighted <mark> and pasted it into both modes. true kept <span style="background-color: …">, while plaintext-only inserted only the text.

Screenshots / recordings

N/A, no visual change beyond the paste result.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Requested by: @Brendonovich (Brendan via Slack)

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The fix looks right. plaintext-only is the right tool here, and the two updated selectors keep tab drag disabled and the document search handlers quiet while a title is being edited. command.tsx already relies on isContentEditable. I type-checked packages/app (it passes) but couldn't run a browser here, so the paste itself is unverified.

Public API: unchanged.

One thing to fix before merging: three e2e tests find the rename editor with [data-slot="tab-title"][contenteditable="true"], so they will time out now. They are in packages/app/e2e/regression/tabs.spec.ts:128 and packages/app/e2e/regression/session-header.spec.ts:220 and :244. Updating them to [contenteditable="plaintext-only"], or matching just [data-slot="tab-title"][contenteditable], would fix it.

Comment thread packages/app/src/shell/titlebar/tab-nav.tsx
@Brendonovich
Brendonovich merged commit f7d5b6f into dev Oct 22, 2026
21 checks passed
@Brendonovich
Brendonovich deleted the fix/tab-title-plain-paste branch October 22, 2026 10:17

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The e2e locator point is addressed: all three tests now look for the editor by [contenteditable="plaintext-only"], and no test still uses the old "true" selector. Nothing new to raise. I couldn't run the e2e tests or the paste here because there's no browser in this sandbox. The e2e type check shows no errors in the two updated files.

Public API: unchanged.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant