[MAGNOLIA-523] SimpleNavigationTag showing empty <ul> when no visible children Created: 10/Aug/05  Updated: 17/Mar/09  Resolved: 09/Jul/08

Status: Closed
Project: Magnolia
Component/s: taglibs
Affects Version/s: 2.1 Final
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: John Olival Assignee: Philipp Bärfuss
Resolution: Cannot Reproduce Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:

 Description   

When displaying the navigation for elements that have children and if all the elements' children are set to hideInNav, an empty ul: <ul class="levelx"></ul> is shown. In CSS drop-down navigation menus, this displays as an empty block, but also it is syntactically incorrect HTML. This is only a problem for elements which are located anywhere in the branch of a selected element. E.g. In the tree

Home
+ Section 1
...
+ Section 2
+ Subsection 2.1
+ Subsection 2.2
+ Page 2.2.1
+ Page 2.2.2
+ Page 2.2.3
+ Subsection 2.3
+ Page 2.3.1
+ Page 2.3.2
+ Page 2.3.3
...

Pages under 2.2 are marked as hideInNav; if Page 2.2.1 is selected so is the currently active page, then an empty ul element is created.

Having looked at the code, I reckon the fix is here (line 249):

if (activePage.getHandle().equals(child.getHandle())) {
// self
// check if child has visible children
if (hasVisibleChildren(child))

{ showChildren = true; }

self = true;
cssClasses.add("active"); //$NON-NLS-1$
}

It hasn't been tested.

John



 Comments   
Comment by Magnolia International [ 09/Jul/08 ]

Can't reproduce with 3.6 and it doesn't seem anything related to this has been changed in a while. If this is still the case, please provide a small export file + sample template to demonstrate this.

Generated at Mon Feb 12 03:18:16 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.