Cssclasses persist after changing to a different note (that doesn't have any properties set)

Steps to reproduce

  1. Open to which I a custom CSS class is added, using the cssclasses property.
  2. Switch to a different note in the same view.

Did you follow the troubleshooting guide? Y

Expected result

The newly opened note should not have the cssclasses of the previously opened note applied to it. After all, the custom CSS class is only attached to the previously opened note, not the newly opened note.

Actual result

The newly opened note has the cssclasses from the previously opened note applied to it.


	Obsidian version: v1.4.5
	Installer version: v1.3.5
	Operating system: Darwin Kernel Version 21.6.0: Thu Jun  8 23:57:12 PDT 2023; root:xnu-8020.240.18.701.6~1/RELEASE_X86_64 21.6.0
	Login status: not logged in
	Insider build toggle: off
	Live preview: on
	Legacy editor: off
	Base theme: adapt to system
	Community theme: none
	Snippets enabled: 1
	Restricted mode: on

Additional information

I created and enabled a CSS snippet red-text.css to easily inspect the issue:

.red-text {
    color: red;

I then added the following snippet to note 1:

  - red-text

This turns the text of note 1 red, as expected. However, after opening some other note in the same view as note 1, the text is still red—this should not be the case.

I am not sure if this bug was introduced with Obsidian v1.4.x, but I did not encounter the bug before on v1.3.x.

Force reloading the view resolves the issue. The issue is only present when opening a new note in the same tab.

Screenshots of the situation:

1 Like

The provided CSS snippet doesn’t make much sense and it shouldn’t work the way you expect.

I am gonna need new repro steps.

I have the same issue. But I actually have something useful.

This is my css:

.md-bigview {
    --file-line-width: 100%;

What I want is to have some notes be full width, primarily useful for dashboards, and not others.

Same leaf (both source mode):

As is seen, this note does not have cssclasses: md-bigview in its YAML, so its effect should not be applied. However, when we go into the HTML, it still has it applied.

<div class="markdown-source-view cm-s-obsidian mod-cm6 is-folding show-properties is-readable-line-width node-insert-event md-bigview" style="">

This is expected for the previous note, but for this one it should be:

<div class="markdown-source-view cm-s-obsidian mod-cm6 is-folding show-properties is-readable-line-width node-insert-event" style="">

Separate Leafs (both source mode):

What is desired is for a note to only have its own css-classes as specified in the YAML, not those of previous notes in the leaf, it is highly annoying.

Ok I reproed. you need to switch to a note that has no properties set/no yaml section at all for this to happen.

will be fixed 1.4.10

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.