wvuweb / cleanslate-cms

A place to file issues and view releases for CleanSlate CMS. http://cleanslatecms.wvu.edu
6 stars 0 forks source link

Don't output empty `<ul>`'s for `sub_menu` and `ancestor_menu` when they return zero pages #264

Closed adamjohnson closed 3 years ago

adamjohnson commented 3 years ago

Steps to reproduce the issue

You can see this on this test page in the sidebar. Here's the code in that Radius snippet:

<p>Sub menu (no sub pages / empty ul):</p>

<r:sub_menu ul_class="sub-menu" />

<p>Ancestor Menu (empty ul)</p>

<r:ancestor_menu ul_class="ancestor-menu" start_depth="6" max_depth="1" />

Results

r:sub_menu and r:ancestor_menu output empty <ul>'s when no pages are returned. Here's the markup from the test page above:

<p>Sub menu (no sub pages / empty ul):</p>

<ul class="sub-menu"></ul>

<p>Ancestor Menu</p>

<ul class="ancestor-menu"></ul>

Expected results

If a sub_menu or ancestor_menu is called and returns zero pages, the <ul> should not be output into the DOM.

Expected markup:

<p>Sub menu (no sub pages / empty ul):</p>

<p>Ancestor Menu</p>

Siteimprove NextGen Accessibility flags this as an issue and will 1) get flagged in their UI as such and 2) subtract points from the overall accessibility score. You can see the issue for yourself by downloading one of the Siteimprove Accessibility Browser Extensions and running it on the test page.

Screenshot showing the Siteimprove Browser Extension highlighting an empty unordered list tag

adamjohnson commented 3 years ago

Looks great, thanks!