To install, just visit the TiddlyTools link shown above and drag-and-drop the title of that tiddler into your TiddlyWiki. It contains only pure CSS and wikitext (i.e., no Javascript), so it will take effect as soon as you import it… and, if you don’t want it anymore, just delete that tiddler and all will immediately revert to the normal topbar/scrollbar handling.
This hybrid stylesheet/control panel tiddler adds several nice features to your TiddlyWiki page:
You can pin/unpin the “top bar” toolbar
handles both TWCore’s standard .tc-topbar and MenuBar Plugin’s .tc-menubar
when “pinned”, two “push pin” icons will appear in the upper-left and upper-right corners of your page
when “unpinned”, the icons change to “up+down arrows” and the top bar slides up out of the way until you move your mouse near the top corners of the page
You can also set the scale factor for top bar content (default size=1). Decimal values (e.g., “1.5”) are permitted.
The stylesheet also prevents the StoryRiver “scroll-under” effect (where StoryRiver content overlaps and disappears under the top bar when scrolling)
and… most relevant to your question:
The stylesheet places the StoryRiver scrollbar directly to the right or left of the StoryRiver content (i.e., not next to the sidebar scrollbar), thereby avoiding the “double vertical scrollbar” problem you mentioned.
Once installed, you can configure the top bar options (including the Story River scrollbar position) by viewing the $:/ControlPanel > Settings > TopBar tab. Alternatively, for quicker access you can simply ctrl-click on either pin icon and a “Setup TopBar” popup will appear.
In addition to the Control panel “pin TopBars” checkbox, you can also quickly toggle that setting just by clicking on either pin icon. To re-pin the top bar, move the mouse over the upper-left or upper-right corner of the page. The “up+down arrows” will slide into view. You can then click on either icon to toggle the “pin TopBars” setting.
@EricShulman … That’s interesting. Which CSS setting exactly is responsible for the story river scrollbar. I would be interested in this setting but only this setting.
To try it, place the code above in a tiddler called, for example, my-tw-overrides, give it the tag $:/tags/Stylesheet and save the tiddler.
First, I prevent scrolling on the root HTML element completely and control “global scroll” via the body element.
overflow-x:hidden;
I never need to scroll my wiki left/right.
For the body element…
scrollbar-color:transparent transparent;
Essentially, this “hides” the scrollbars on the body element. I don’t need to see them because I always use the mousewheel and never drag the slider/thumb.
scrollbar-gutter:stable; overflow:auto;
Together, these stop the the geometry of the body element changing when the scrollbar appears and disappears during normal use.
scrollbar-width:thin;
Even though the scrollbars are hidden via transparency, they are still present. This setting reduces the amount of space they take up.
.tc-page-container { height:100vh; } prevents the overall page from exceeding the window height, which would add an unneeded scrollbar since all scrolling will now occur directly in the tc-sidebar-scrollable and .tc-story-river elements
.tc-story-river { max-height:calc(100vh - 2em); margin-top:2em; } forces a scrollbar to appear when the StoryRiver exceeds the window height, and makes room for the scrollbar arrows to be displayed.
.tc-story-river { direction:rtl; } causes the scrollbar to appear on the left side of the StoryRiver
.tc-story-river > * { direction: ltr; } reverts the text flow direction for content within the StoryRiver
If you don’t want the scrollbar on the left, just omit the last two CSS rules.
There’s some minor margin/padding differences from the TWCore default styles (for example, the left scrollbar takes up room, pushing the StoryRiver content a bit to the right), but IMO they aren’t critical, so I’ll leave it up to you to experiment with adjustments to suit your taste.
As a result of this discussion thread, I have just updated TiddlyTools/Stylesheet/TopBar to add a <<startup>> macro that is invoked automatically via $:/tags/StartupAction/PostRender processing.
This <<startup>> macro modifies the $:/core/ui/PageTemplate/story shadow tiddler to change all instances of <section ...> to <$scrollable ...> and fixes a long-standing deficiency in TiddlyTools/Stylesheet/TopBar which prevented TWCore “scrollTo” handling when navigating to a tiddler that is open in the StoryRiver, but not currently in view.
Note that this automatic modification is only performed if the $:/core/ui/PageTemplate/story tiddler has not been previously edited (i.e., it is an actual shadow tiddler). This avoids any conflict with other 3rd-party add-ons that may have already altered the $:/core/ui/PageTemplate/story tiddler.
For the technically-minded, here’s what the newly-added macro definition does:
There are side-effects to applying the properties of the $scrollable widget, most notably, pointer-events associated with scrolling and (though I’m not sure or convinced yet) perhaps even the stacking context. Let me explain:
I have a checkbox which renders on draft tiddlers. The checkbox adds a tag “edit-wide”. When that tag is present, the edited tiddler is rendered “double width” (great for system tiddlers).
/* make draft tiddlers extra wide if tagged edit-wide */
div.tc-tiddler-frame.tc-tagged-edit-wide[data-tiddler-title*="Draft of"] {
width:<<MAIN-VIEW-WIDTH>>;
z-index:1201;
}
When I edited my $:/core/ui/PageTemplate/story and changed <section> elements to $scrollable widgets, I lost the ability to use the edit-wide tag successfully. When the tiddler became double wide, the extra width which normally appears above the sidebar, disappeared under the sidebar making the tiddler controls inaccessible. (Scrolling the tiddler to the right made them accessible.) And note, the z-index failed, too.
When I reverted the change back to <section>, the problem disappeared. I spent a couple of hours trying to find a way to make it work but failed – hence my diagnosis above. There’s “baggage” here that is not obvious or readily reconcilable.
Regarding mitigation, this, of course, was a wise move, Eric…
Note that the $scrollable widget automatically adds overflow:auto; directly to the .tc-story-river element, so overflow:visible !important is needed to override it.
This should override the scrollbar-related styles added by TiddlyTools/Stylesheet/TopBar whenever any tiddler is tagged with edit-wide, thereby allowing those tiddlers to overlap on top of the sidebar as you want them to.
Two other temporary side-effects of this CSS will be:
The StoryRiver scrollbar position will revert to the default TWCore right side position
When scrolling the StoryRiver, tiddlers can overlap with and will scroll under any TopBar/MenuBar display.
If your customized $:/core/ui/PageTemplate/Story is using <$scrollable class="tc-story-river"> in place of <section class="tc-story-river" ...>, you may not need all of my suggested CSS, but you will still need to use at least:
.tc-story-river { overflow:visible !important; }
to overide the overflow:auto; that the $scrollable widget automatically applies directly to the .tc-story-river element.
That doesn’t work for me, although your TiddlyTools stylesheet does. I get the left scrollbar for the story river but still get two on the right, when the sidebar has enough content displayed:
Did you use the “simplified” modification of $:/core/ui/PageTemplate/story tiddler, or did you import a copy of my TiddlyTools/Stylesheet/Topbar?
Can you post your TiddlyWiki somewhere that I can try to debug the issue?
If it has private info, perhaps you can create a “minimal test case” that still illustrates the problem without your info.
Alternatively, we could arrange to meet live via a “voice channel” on the TiddlyWiki discord server so you could screen share and I can walk you through debugging it. (see https://tiddlywiki.com/#TiddlyWiki on the Web for a link to the Discord server invite)