Repository navigation
Conversation
3 of 6 tasks
Contributor
|
Thanks for porting this to V2, @imsoul11! I think this duplicates #59159. It also closes #53519 and keeps the code block copy button pinned while you scroll through long code blocks. It keeps the button where it is today instead of adding a header strip, and it includes a component test. If you think the language label or the always-visible header strip is worth having, please comment on #59159 or review and test it there, so the discussion stays in one place. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #53519
Type of change
What does this PR do?
Port of #53522 to V2 (that one was closed because V1 is no longer accepting PRs).
Long code blocks lose their copy button: it sits at the top of the block and scrolls away with the content, so you have to scroll back up to copy.
This adds a slim sticky header strip to each markdown code block — language label on the left, copy button on the right. The strip floats pinned at the top while scrolling through tall code and scrolls away when the block ends. No height cap, so the block still extends fully. The button is always visible, which also removes the old hover show/hide flicker.
Changed files:
packages/session-ui/src/components/markdown.css— wrapper becomes a flex column, the copy-button host becomes the sticky strip, and the code block's top corners/border join the strip so it reads as one box.packages/session-ui/src/components/markdown.tsx— the language label is copied onto the strip host (and re-synced inapplyCodeMetadata), so it survives streaming re-renders. Copy behavior itself is untouched.Works for both streamed and completed blocks (both use a
preinside[data-component="markdown-code"]). Mermaid blocks still hide the pre and strip once the diagram renders.How did you verify your code works?
bun test srcinpackages/session-ui: 317 pass, 0 failtsc -binpackages/session-ui: clean; prettier: cleanScreenshots / recordings
Before + after (recorded against V1; the V2 styling is unchanged apart from the strip): https://drive.google.com/drive/folders/1JsEkJbQ2TeCiMD-LkjR-fz3WmQxHaboq?usp=sharing
Checklist