Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes Accessibility issues #428

Closed
wants to merge 9 commits into from
7 changes: 4 additions & 3 deletions scripts/boxesserver
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,9 @@ class BServer:
continue
if len(group._group_actions) == 1 and isinstance(group._group_actions[0], argparse._HelpAction):
continue
prefix = getattr(group, "prefix", None)
result.append('''<h3 id="h-%s" class="open" onclick="showHide(%s)">%s</h3>\n<table role="presentation" id="%s">\n''' % (groupid, groupid, _(group.title), groupid))
prefix = getattr(group, "prefix", None)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adds event handler for keyboard enter press and tab index to allow for tab navigation on clickable headings and a more device independent event handler.

result.append('''<h3 id="h-%s" tabindex="0" class="open" onclick="showHide(%s)" onkeypress="if(event.keyCode == 13) showHide(%s)">%s</h3>\n<table role="presentation" id="%s">\n''' % (groupid, groupid, groupid, _(group.title), groupid))

for a in group._group_actions:
if a.dest in ("input", "output"):

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This newline doesn't need to be integrated my bad...

Expand Down Expand Up @@ -341,7 +342,7 @@ class BServer:
""" ]
for nr, group in enumerate(self.groups):
result.append(f'''
<h3 id="h-{nr}" class="open" onclick="showHide('{nr}')"
<h3 id="h-{nr}" class="open" tabindex="0" onclick="showHide('{nr}')" onkeypress="if(event.keyCode == 13) showHide('{nr}')"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adds event handler for keyboard enter press and tab index to allow for tab navigation on clickable headings and a more device independent event handler.

onmouseenter="change('{group.name}', 'static/samples/{group.thumbnail}')"
onmouseleave="changeback('{group.name}')">{_(group.title)}</h3>
<img style="width: 200px;" id="sample-{group.name}" src="static/nothing.png" alt="">
Expand Down