Scope the global button:not(.clickable-icon) color override to .tldraw-view-root - #210
Open
mnaoumov wants to merge 1 commit into
Open
Scope the global button:not(.clickable-icon) color override to .tldraw-view-root#210mnaoumov wants to merge 1 commit into
mnaoumov wants to merge 1 commit into
Conversation
The global rule applied `color: currentColor` to every button in Obsidian, not just tldraw's, overriding Obsidian's default button text color app-wide and breaking contrast outside tldraw (Settings buttons, Notice action buttons). Scope it to the tldraw view, matching the convention already used for the .tldraw-view-root .tlui-button override below it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
mnaoumov
added a commit
to mnaoumov/obsidian-dev-utils
that referenced
this pull request
Jun 26, 2026
The tldraw Obsidian plugin ships an unscoped global
`button:not(.clickable-icon) { color: currentColor }` rule that overrides
Obsidian's own `button:not(.clickable-icon) { color: var(--text-color) }`
app-wide. Obsidian sets `--text-color` contextually per button variant, so
tldraw's `currentColor` discards that and breaks button contrast in any consuming
plugin's UI -- e.g. white-on-white action buttons inside a Notice. Re-assert
Obsidian's own value with a `body`-prefixed selector (specificity 0,1,2) so it
wins over tldraw's (0,1,1) while staying correct for every variant. Defensive
workaround until the upstream fix ships (tldraw/obsidian-plugin#210).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Fixes #203.
src/styles.cssships an unscoped global rule:Because it isn't scoped to a tldraw container, it applies to every
<button>in Obsidian, overriding Obsidian's defaultbutton:not(.clickable-icon){color:var(--text-color)}app-wide.currentColorthen resolves to whatever text color the surrounding context inherits, so buttons outside tldraw lose contrast wherever that differs from their background — e.g. the Settings "Check for Updates" button in #203, and action buttons inside aNotice(white-on-white).This scopes the rule to
.tldraw-view-root, matching the convention already used right below it for the.tldraw-view-root .tlui-buttonoverride. Specificity becomes (0,2,1), so it still wins over Obsidian's (0,1,1) inside the tldraw view, while no longer leaking to the rest of the app.Note: this assumes all tldraw buttons live under
.tldraw-view-root(true for the in-view UI; the existing.tldraw-view-root .tlui-buttonoverride relies on the same assumption). If any tldraw UI is portaled outside that root,.tl-containerwould be the alternative scope.