Skip to content

馃拕 style(highlighter): make code block header sticky with copy button - #504

Open
Innei wants to merge 1 commit into
masterfrom
fix/sticky-code-header
Open

Innei wants to merge 1 commit into
masterfrom
fix/sticky-code-header

Conversation

@Innei

@Innei Innei commented Apr 22, 2026

Copy link
Copy Markdown
Member

Summary

  • Change root overflow: hidden to overflow: clip to allow sticky-positioned children to escape the clipping container
  • Make code block header position: sticky; top: 0 so the copy button stays visible when scrolling through long code blocks
  • Add container background to header for proper sticky rendering (content doesn't show through)

Related

Test plan

  • Open a chat with a long code block, scroll down - copy button should remain visible at top
  • Code block border-radius clipping should still work correctly
  • Expand/collapse toggle should still work

- Change root overflow from hidden to clip to allow sticky children to escape
- Make header sticky at top so copy button stays visible when scrolling long code
- Add container background to header for proper sticky rendering

Fixes lobehub/lobehub#6764
Fixes lobehub/lobehub#7129
@vercel

vercel Bot commented Apr 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
lobe-ui Ignored Ignored Preview May 19, 2026 0:39am

Request Review

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

We've reviewed this pull request using the Sourcery rules engine

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

馃挕 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e0c53909a5

鈩癸笍 About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 馃憤.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/Highlighter/style.ts
Comment on lines +57 to +59
position: sticky;
top: 0;
z-index: 3;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Add opaque background to all sticky header variants

Making headerRoot sticky applies to every highlighter variant, but only headerFilled now gets an explicit background. In fullFeatured mode with variant="outlined" or variant="borderless", scrolling long code blocks causes code text to move underneath a transparent sticky header, which reduces readability and can make action buttons hard to see. Since this behavior is introduced by the new sticky positioning, the header should use an opaque background for the non-filled variants as well.

Useful? React with 馃憤聽/ 馃憥.

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

Labels

None yet

Projects

None yet

1 participant