Skip to content

Commit

Permalink
wmlunits: Update menu markup to allow for CSS column layouts
Browse files Browse the repository at this point in the history
  • Loading branch information
irydacea committed Aug 14, 2017
1 parent 9f84342 commit ef406b6
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions data/tools/unit_tree/html_output.py
Expand Up @@ -501,15 +501,13 @@ def add_menu(menuid, name, classes='', is_table_container=False):
"""
html_name = cleantext(name)
html_classes = " ".join((cleantext(classes), "popuptrigger"))
# FIXME: This is legacy code needed for the Language menu, since it's
# a table and we can't make it otherwise because CSS column
# support is still hit-or-miss for some browsers still in use.
child_tag = 'ul' if not is_table_container else 'div'
label_tag = 'li' if not is_table_container else 'div'
write('<li class="popupcontainer" role="menuitem" aria-haspopup="true">')
write('<a class="' + html_classes + '" href="#">' + html_name + '</a>')
write('<' + child_tag + ' class="popupmenu" id="' + menuid + '" role="menu" aria-label="' + html_name + '">')
write('<' + label_tag + '>' + html_name + '</' + label_tag + '>')
write('<div id="%s" class="popupmenu" role="menu" aria-label="%s">' %
(menuid, html_name))
write('<div class="popupheader">' + html_name + '</div>')
if not is_table_container:
write('<ul>')

def add_menuitem_placeholder():
"""Writes a horizontal bar serving as a menu placeholder."""
Expand Down Expand Up @@ -540,9 +538,8 @@ def end_menu(is_table_container=False):
original.
"""
if not is_table_container:
write('</ul></li>\n')
else:
write('</div></li>')
write('</ul>')
write('</div></li>')

# We may not have all the required info yet so defer writing the
# campaigns/eras navigation.
Expand Down

0 comments on commit ef406b6

Please sign in to comment.