Repository navigation
fix(app): paste plain text when renaming session tabs - #58036
Conversation
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Issue for this PR
Closes #
Type of change
What does this PR do?
Renaming a session tab uses a
contenteditablespan. Withcontenteditable="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 matchplaintext-only, so tab drag stays disabled while editing and the document search keydown handlers still ignore keystrokes in the title.isEditableTargetincommand.tsxalready usesisContentEditable, which covers both.How did you verify your code works?
bun run typecheckinpackages/appcontenteditable="true".tabs.spec.tsandsession-header.spec.tsnow pass in built mode (33/33).<mark>and pasted it into both modes.truekept<span style="background-color: …">, whileplaintext-onlyinserted only the text.Screenshots / recordings
N/A, no visual change beyond the paste result.
Checklist
Requested by: @Brendonovich (Brendan via Slack)