Skip to content

Fix code block copy button positioning / 修复代码块复制按钮定位#5398

Merged
SivanCola merged 1 commit into
esengine:main-v2from
SivanCola:fix/code-copy-button-stable
Jun 26, 2026
Merged

Fix code block copy button positioning / 修复代码块复制按钮定位#5398
SivanCola merged 1 commit into
esengine:main-v2from
SivanCola:fix/code-copy-button-stable

Conversation

@SivanCola

Copy link
Copy Markdown
Collaborator

Summary

  • Move the code-block copy button out of the scrollable <pre> and keep it as a sibling inside .code-block__wrap.
  • Update hover and creation-mode CSS selectors so copy-button styling follows the new sibling contract.
  • Add a focused frontend regression that verifies the rendered DOM shape and guards the selector contract.

Fixes #5096.

Consolidation notes

Kept/adapted:

Reviewed but not adopted:

Repository Contributor Credits

Cache impact

Cache-impact: none — desktop frontend DOM/CSS/test changes only; no provider request, system prompt, tool schema, memory prefix, compaction, or reasoning upload behavior changes.
Cache-guard: N/A for cache; frontend regression and CSS checks cover this UI contract.
System-prompt-review: N/A.

Verification

  • pnpm --dir desktop/frontend exec tsx src/__tests__/code-block-copy-position.test.tsx
  • pnpm --dir desktop/frontend check:css
  • pnpm --dir desktop/frontend typecheck
  • git diff --check
  • Browser smoke against the Vite dev server: injected a long code-block fixture and verified the copy button is a sibling of the scrollable <pre>, the <pre> still scrolls, the creation-mode sibling selector matches, and the old descendant selector does not match.

@SivanCola SivanCola requested a review from esengine as a code owner June 26, 2026 19:13
@github-actions github-actions Bot added v2 Go rewrite (1.x) — main-v2 branch, active development desktop Wails desktop app (desktop/**) labels Jun 26, 2026
@SivanCola SivanCola merged commit 5c9209b into esengine:main-v2 Jun 26, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

desktop Wails desktop app (desktop/**) v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: 代码块横向滚动时复制按钮会跟随内容移动

1 participant