fix(codeblock-tree): float the copy button in the top-right corner - #739
Merged
michaelpporter merged 1 commit intoJul 25, 2026
Conversation
The button asked for `absolute bottom-2 right-2`, but src/styles.css imports only `tailwindcss/utilities` — in Tailwind v4 the numeric spacing scale lives in the theme layer, so `bottom-2`, `right-2` and the `pr-10` content padding all compiled to nothing. An absolutely positioned element with no insets sits at its static position, putting the button over the first row's collapse arrow. Positions the button (and the row padding that keeps note flair clear of it) with plain CSS against Obsidian's --size-4-* variables, so it no longer depends on the missing Tailwind scale. Scoped to the tree codeblock. The wider problem — 99 spacing utilities across 15 files silently compiling to nothing — is left untouched here. Refs #736
This was referenced Jul 25, 2026
michaelpporter
merged commit Jul 25, 2026
219d60a
into
734-bug-tree-view-fails-for-links-with-block-references
michaelpporter
deleted the
736-fr-move-the-buttons-to-the-up-right-in-tree-view-code-block
branch
July 25, 2026 15:50
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.
Refs #736 — intentionally not an auto-closing keyword; the issue is closed when the fix ships in a release.
What's actually wrong
This came in as a feature request ("can the buttons move to the top-right?"), but it's a bug.
CodeblockTree.sveltealready asked for a floating button:src/styles.cssimports onlytailwindcss/utilities. In Tailwind v4 the numeric--spacingscale lives in the theme layer, sobottom-2,right-2and thepr-10content padding have nothing to resolve to and are dropped at build time — verified, they're absent from the compiledstyles.csswhile.absoluteand.flexare present.An absolutely positioned element with no insets sits at its static position: the top-left of
.BC-codeblock-tree-items, directly over the first row's collapse arrow. That's exactly what the reporter's screenshot shows.Fix
Positioning is now plain CSS against Obsidian's own size variables, so it doesn't depend on the missing Tailwind scale:
--size-4-2is already used elsewhere in this repo.--size-4-10isn't, and I couldn't verify it from the packaged app, so it carries an explicit2.5remfallback — a silently-missing value is precisely what caused this bug.Verified the rules survive the build rather than trusting the source:
Deliberately out of scope
The root cause is repo-wide: 99 spacing-utility usages across 15 files currently compile to nothing. Fixing it (
@import "tailwindcss/theme" layer(theme);) would produce an unverified visual diff everywhere at once, so it's left for its own PR.Worth noting the Mermaid and Markmap codeblocks are broken the same way — they use
left-2 top-2, so losing the offsets leaves them near where they belong and the damage isn't obvious. They're untouched here.bun run build && bun run testpass (379 tests, 0 type errors).