Something that has annoyed me ever since I found the built-in tabs macro, is that if you don’t supply a default tab, then the default display is that no tab is selected. IMHO, that is plain ugly and also inconsistent, since once you have selected a tab there is no way to go back to nothing selected (apart from deleting the relevant state tiddler).
I created a modified tabs macro that defaults to the first title if no default is supplied and it seems to be OK:
Edit: the changes are the two
$set
widgets after the$qualify
\define tabs(tabsList,default,state:"$:/state/tab",class,template,buttonTemplate,retain,actions,explicitState)
\whitespace trim
<$qualify title=<<__state__>> name="qualifiedState">
<$set name="firsttab" filter="[filter<__tabsList__>first[]]">
<$set name="__default__" filter="[<__default__>is[tiddler]else<firsttab>]">
<$let tabsState={{{ [<__explicitState__>minlength[1]] ~[<qualifiedState>] }}}>
<div class={{{ [[tc-tab-set]addsuffix[ ]addsuffix<__class__>] }}}>
<div class={{{ [[tc-tab-buttons]addsuffix[ ]addsuffix<__class__>] }}}>
<<tabs-tab-list>>
</div>
<div class={{{ [[tc-tab-divider]addsuffix[ ]addsuffix<__class__>] }}}/>
<div class={{{ [[tc-tab-content]addsuffix[ ]addsuffix<__class__>] }}}>
<<tabs-tab-body>>
</div>
</div>
</$let>
</$set>
</$set>
</$qualify>
\end
Is there a reason for defaulting to no tabs? Why not default to the first title?