Closed james-cnz closed 2 years ago
Ignore this. I've started looking at addressing #83, which makes this irrelevant.
I've suggested #107 instead of #98, so this is relevant again.
Here's a screenshot of problems:
I think this is mostly solved now.
Recently there was the change Fix the index sub-tab name when childs are hidden to address the issue
92 Text in first child tab should always inherit from parent tab
I think there are still some problems remaining though.
When the code looks back through sections to find the previous first-level section, it ignores sections set as second-level, except section 0 (which will always be first-level regardless of setting). I think this is mostly right, but if section 0 is visualised before the tabs, then it should also not ignore the first visible section after section 0 (this will also always be first-level regardless of setting). Also, when the code looks back, it doesn't ignore hidden (first-level) sections, which I think it should. To fix these, instead of looking back to find the previous first-level section, I have used the approach of remembering the most recent first-level section. I have changed a nested if statement into a single check to avoid duplicate code (indenting is fixed in a separate change, to make the initial change more readable).
The code to determine when an index tab is selected still assumes the previous section is the parent. To fix this, I have referred to the previously found parent section.
Unrelated, but I also noticed tabs' CSS class, as set in $specialstyle has tablevel{$level}, where $level is the level setting, not accounting for exceptions (section 0, or first following section if section 0 is visualised before the tabs). To fix this, I have moved the check count($tabs) == 0 earlier.