Custom css that relies on nth child/of type etc. doesn’t work correctly due to obsidian removing elements from the dom when they go off screen from scrolling, whether or not they’re still in the active note or nav tree, making it impossible to iterate through the entire nav tree/section/note and have a specific element consistently stay the name nth number.
I spent a while setting up my nav tree folders to have iterative rainbow colors, but to my dismay my folders change colors, which was extremely confusing and disruptive, as I expand and scroll and the elements not currently showing get removed. I’ve previously tried to have headers in a file have styles that were based on nth child as well, and it was impossible to achieve for the same reason.
Proposed solution
I would really appreciate at least a toggle to disable the removal of these elements from the nav tree entirely, the currently active note being viewed, etc. or something else, some sort of numbered hook, that would allow for iterative styling and any other custom css requiring the use of nth over a long enough area that it’s scrolled to remain consistent for all elements in it, not just the ones that are currently on screen.
I had a need to make table column headers dynamically attached at the top when scrolling, but it didn’t work. If it wasn’t for holroy’s reply (below), I wouldn’t have realized what was wrong.
In my case, compatibility of unloading of non-visible file elements from memory with CSS’s position: sticky will be enough.