Main tab order

merge-requests/30/head
Bob Mottram 2022-05-25 11:36:15 +01:00
parent 39b1d1d8f4
commit 828862fd57
2 changed files with 35 additions and 27 deletions

View File

@ -56,7 +56,7 @@ def header_buttons_timeline(default_timeline: str,
# first button # first button
if default_timeline == 'tlmedia': if default_timeline == 'tlmedia':
tl_str += \ tl_str += \
'<a href="' + users_path + '/tlmedia" tabindex="-1" ' + \ '<a href="' + users_path + '/tlmedia" tabindex="2" ' + \
'accesskey="' + access_keys['menuMedia'] + '"' 'accesskey="' + access_keys['menuMedia'] + '"'
if box_name == 'tlmedia': if box_name == 'tlmedia':
tl_str += ' aria-current="location"' tl_str += ' aria-current="location"'
@ -67,7 +67,7 @@ def header_buttons_timeline(default_timeline: str,
elif default_timeline == 'tlblogs': elif default_timeline == 'tlblogs':
tl_str += \ tl_str += \
'<a href="' + users_path + \ '<a href="' + users_path + \
'/tlblogs" tabindex="-1"' '/tlblogs" tabindex="2"'
if box_name == 'tlblogs': if box_name == 'tlblogs':
tl_str += ' aria-current="location"' tl_str += ' aria-current="location"'
tl_str += \ tl_str += \
@ -77,7 +77,7 @@ def header_buttons_timeline(default_timeline: str,
elif default_timeline == 'tlfeatures': elif default_timeline == 'tlfeatures':
tl_str += \ tl_str += \
'<a href="' + users_path + \ '<a href="' + users_path + \
'/tlfeatures" tabindex="-1"' '/tlfeatures" tabindex="2"'
if box_name == 'tlfeatures': if box_name == 'tlfeatures':
tl_str += ' aria-current="location"' tl_str += ' aria-current="location"'
tl_str += \ tl_str += \
@ -87,7 +87,7 @@ def header_buttons_timeline(default_timeline: str,
else: else:
tl_str += \ tl_str += \
'<a href="' + users_path + \ '<a href="' + users_path + \
'/inbox" tabindex="-1"><button class="' + \ '/inbox" tabindex="2"><button class="' + \
inbox_button + '"' inbox_button + '"'
if box_name == 'inbox': if box_name == 'inbox':
tl_str += ' aria-current="location"' tl_str += ' aria-current="location"'
@ -102,7 +102,7 @@ def header_buttons_timeline(default_timeline: str,
if not features_header: if not features_header:
tl_str += \ tl_str += \
'<a href="' + users_path + '/dm" tabindex="-1"' '<a href="' + users_path + '/dm" tabindex="3"'
if box_name == 'dm': if box_name == 'dm':
tl_str += ' aria-current="location"' tl_str += ' aria-current="location"'
tl_str += \ tl_str += \
@ -115,7 +115,7 @@ def header_buttons_timeline(default_timeline: str,
acct_dir(base_dir, nickname, domain) + '/tlreplies.index' acct_dir(base_dir, nickname, domain) + '/tlreplies.index'
if os.path.isfile(replies_index_filename): if os.path.isfile(replies_index_filename):
tl_str += \ tl_str += \
'<a href="' + users_path + '/tlreplies" tabindex="-1"' '<a href="' + users_path + '/tlreplies" tabindex="4"'
if box_name == 'tlreplies': if box_name == 'tlreplies':
tl_str += ' aria-current="location"' tl_str += ' aria-current="location"'
tl_str += \ tl_str += \
@ -253,7 +253,7 @@ def header_buttons_timeline(default_timeline: str,
tl_str += ' aria-current="location"' tl_str += ' aria-current="location"'
tl_str += \ tl_str += \
'><button class="' + \ '><button class="' + \
sent_button + '" tabindex="-1" accesskey="' + \ sent_button + '" tabindex="5" accesskey="' + \
access_keys['menuOutbox'] + '">' + \ access_keys['menuOutbox'] + '">' + \
'<span>' + translate['Sent'] + '</span></button></a>' '<span>' + translate['Sent'] + '</span></button></a>'
@ -269,7 +269,8 @@ def header_buttons_timeline(default_timeline: str,
tl_str += \ tl_str += \
'<a class="imageAnchor" href="' + users_path + \ '<a class="imageAnchor" href="' + users_path + \
'/search" accesskey="' + access_keys['menuSearch'] + \ '/search" accesskey="' + access_keys['menuSearch'] + \
'"><img loading="lazy" decoding="async" src="/' + \ '" tabindex="8">' + \
'<img loading="lazy" decoding="async" src="/' + \
'icons/search.png" title="' + \ 'icons/search.png" title="' + \
translate['Search and follow'] + '" alt="| ' + \ translate['Search and follow'] + '" alt="| ' + \
translate['Search and follow'] + \ translate['Search and follow'] + \
@ -278,7 +279,7 @@ def header_buttons_timeline(default_timeline: str,
# the search button # the search button
tl_str += \ tl_str += \
'<a href="' + users_path + \ '<a href="' + users_path + \
'/search" tabindex="-1">' + \ '/search" tabindex="8">' + \
'<button class="button" ' + \ '<button class="button" ' + \
'accesskey="' + access_keys['menuSearch'] + '>' + \ 'accesskey="' + access_keys['menuSearch'] + '>' + \
'<span>' + translate['Search'] + \ '<span>' + translate['Search'] + \
@ -300,14 +301,15 @@ def header_buttons_timeline(default_timeline: str,
' <a class="imageAnchor" href="' + \ ' <a class="imageAnchor" href="' + \
users_path + calendar_path + \ users_path + calendar_path + \
'" accesskey="' + access_keys['menuCalendar'] + \ '" accesskey="' + access_keys['menuCalendar'] + \
'"><img loading="lazy" decoding="async" src="/icons/' + \ '" tabindex="7">' + \
'<img loading="lazy" decoding="async" src="/icons/' + \
calendar_image + '" title="' + translate['Calendar'] + \ calendar_image + '" title="' + translate['Calendar'] + \
'" alt="| ' + calendar_alt_text + \ '" alt="| ' + calendar_alt_text + \
'" class="timelineicon"/></a>\n' '" class="timelineicon"/></a>\n'
else: else:
tl_str += \ tl_str += \
'<a href="' + users_path + calendar_path + \ '<a href="' + users_path + calendar_path + \
'" tabindex="-1"><button class="button" accesskey="' + \ '" tabindex="7"><button class="button" accesskey="' + \
access_keys['menuCalendar'] + '">' + \ access_keys['menuCalendar'] + '">' + \
'<span>' + translate['Calendar'] + \ '<span>' + translate['Calendar'] + \
'</span></button></a>' '</span></button></a>'
@ -317,15 +319,15 @@ def header_buttons_timeline(default_timeline: str,
if not icons_as_buttons: if not icons_as_buttons:
tl_str += \ tl_str += \
' <a class="imageAnchor" href="' + \ ' <a class="imageAnchor" href="' + \
users_path + '/minimal' + \ users_path + '/minimal" tabindex="6">' + \
'"><img loading="lazy" decoding="async" src="/icons' + \ '<img loading="lazy" decoding="async" src="/icons' + \
'/showhide.png" title="' + translate['Show/Hide Buttons'] + \ '/showhide.png" title="' + translate['Show/Hide Buttons'] + \
'" alt="| ' + translate['Show/Hide Buttons'] + \ '" alt="| ' + translate['Show/Hide Buttons'] + \
'" class="timelineicon"/></a>\n' '" class="timelineicon"/></a>\n'
else: else:
tl_str += \ tl_str += \
'<a href="' + users_path + '/minimal' + \ '<a href="' + users_path + '/minimal' + \
'" tabindex="-1"><button class="button">' + \ '" tabindex="6"><button class="button">' + \
'<span>' + translate['Show/Hide Buttons'] + \ '<span>' + translate['Show/Hide Buttons'] + \
'</span></button></a>' '</span></button></a>'

View File

@ -107,7 +107,7 @@ def _html_timeline_new_post(manually_approve_followers: bool,
if not icons_as_buttons: if not icons_as_buttons:
new_post_button_str += \ new_post_button_str += \
'<a class="imageAnchor" href="' + users_path + \ '<a class="imageAnchor" href="' + users_path + \
'/newdm?nodropdown"><img loading="lazy" ' + \ '/newdm?nodropdown" tabindex="9"><img loading="lazy" ' + \
'decoding="async" src="/' + \ 'decoding="async" src="/' + \
'icons/newpost.png" title="' + \ 'icons/newpost.png" title="' + \
translate['Create a new DM'] + \ translate['Create a new DM'] + \
@ -115,28 +115,30 @@ def _html_timeline_new_post(manually_approve_followers: bool,
'" class="timelineicon"/></a>\n' '" class="timelineicon"/></a>\n'
else: else:
new_post_button_str += \ new_post_button_str += \
'<a href="' + users_path + '/newdm?nodropdown">' + \ '<a href="' + users_path + \
'/newdm?nodropdown" tabindex="9">' + \
'<button class="button"><span>' + \ '<button class="button"><span>' + \
translate['Post'] + ' </span></button></a>' translate['Post'] + ' </span></button></a>'
elif box_name in ('tlblogs', 'tlnews', 'tlfeatures'): elif box_name in ('tlblogs', 'tlnews', 'tlfeatures'):
if not icons_as_buttons: if not icons_as_buttons:
new_post_button_str += \ new_post_button_str += \
'<a class="imageAnchor" href="' + users_path + \ '<a class="imageAnchor" href="' + users_path + \
'/newblog"><img loading="lazy" decoding="async" src="/' + \ '/newblog" tabindex="9">' + \
'<img loading="lazy" decoding="async" src="/' + \
'icons/newpost.png" title="' + \ 'icons/newpost.png" title="' + \
translate['Create a new post'] + '" alt="| ' + \ translate['Create a new post'] + '" alt="| ' + \
translate['Create a new post'] + \ translate['Create a new post'] + \
'" class="timelineicon"/></a>\n' '" class="timelineicon"/></a>\n'
else: else:
new_post_button_str += \ new_post_button_str += \
'<a href="' + users_path + '/newblog">' + \ '<a href="' + users_path + '/newblog" tabindex="9">' + \
'<button class="button"><span>' + \ '<button class="button"><span>' + \
translate['Post'] + '</span></button></a>' translate['Post'] + '</span></button></a>'
elif box_name == 'tlshares': elif box_name == 'tlshares':
if not icons_as_buttons: if not icons_as_buttons:
new_post_button_str += \ new_post_button_str += \
'<a class="imageAnchor" href="' + users_path + \ '<a class="imageAnchor" href="' + users_path + \
'/newshare?nodropdown">' + \ '/newshare?nodropdown" tabindex="9">' + \
'<img loading="lazy" decoding="async" src="/' + \ '<img loading="lazy" decoding="async" src="/' + \
'icons/newpost.png" title="' + \ 'icons/newpost.png" title="' + \
translate['Create a new shared item'] + '" alt="| ' + \ translate['Create a new shared item'] + '" alt="| ' + \
@ -144,14 +146,15 @@ def _html_timeline_new_post(manually_approve_followers: bool,
'" class="timelineicon"/></a>\n' '" class="timelineicon"/></a>\n'
else: else:
new_post_button_str += \ new_post_button_str += \
'<a href="' + users_path + '/newshare?nodropdown">' + \ '<a href="' + users_path + \
'/newshare?nodropdown" tabindex="9">' + \
'<button class="button"><span>' + \ '<button class="button"><span>' + \
translate['Post'] + '</span></button></a>' translate['Post'] + '</span></button></a>'
elif box_name == 'tlwanted': elif box_name == 'tlwanted':
if not icons_as_buttons: if not icons_as_buttons:
new_post_button_str += \ new_post_button_str += \
'<a class="imageAnchor" href="' + users_path + \ '<a class="imageAnchor" href="' + users_path + \
'/newwanted?nodropdown">' + \ '/newwanted?nodropdown" tabindex="9">' + \
'<img loading="lazy" decoding="async" src="/' + \ '<img loading="lazy" decoding="async" src="/' + \
'icons/newpost.png" title="' + \ 'icons/newpost.png" title="' + \
translate['Create a new wanted item'] + '" alt="| ' + \ translate['Create a new wanted item'] + '" alt="| ' + \
@ -159,7 +162,8 @@ def _html_timeline_new_post(manually_approve_followers: bool,
'" class="timelineicon"/></a>\n' '" class="timelineicon"/></a>\n'
else: else:
new_post_button_str += \ new_post_button_str += \
'<a href="' + users_path + '/newwanted?nodropdown">' + \ '<a href="' + users_path + \
'/newwanted?nodropdown" tabindex="9">' + \
'<button class="button"><span>' + \ '<button class="button"><span>' + \
translate['Post'] + '</span></button></a>' translate['Post'] + '</span></button></a>'
else: else:
@ -167,7 +171,7 @@ def _html_timeline_new_post(manually_approve_followers: bool,
if not icons_as_buttons: if not icons_as_buttons:
new_post_button_str += \ new_post_button_str += \
'<a class="imageAnchor" href="' + users_path + \ '<a class="imageAnchor" href="' + users_path + \
'/newpost">' + \ '/newpost" tabindex="9">' + \
'<img loading="lazy" decoding="async" src="/' + \ '<img loading="lazy" decoding="async" src="/' + \
'icons/newpost.png" title="' + \ 'icons/newpost.png" title="' + \
translate['Create a new post'] + '" alt="| ' + \ translate['Create a new post'] + '" alt="| ' + \
@ -175,14 +179,14 @@ def _html_timeline_new_post(manually_approve_followers: bool,
'" class="timelineicon"/></a>\n' '" class="timelineicon"/></a>\n'
else: else:
new_post_button_str += \ new_post_button_str += \
'<a href="' + users_path + '/newpost">' + \ '<a href="' + users_path + '/newpost" tabindex="9">' + \
'<button class="button"><span>' + \ '<button class="button"><span>' + \
translate['Post'] + '</span></button></a>' translate['Post'] + '</span></button></a>'
else: else:
if not icons_as_buttons: if not icons_as_buttons:
new_post_button_str += \ new_post_button_str += \
'<a class="imageAnchor" href="' + users_path + \ '<a class="imageAnchor" href="' + users_path + \
'/newfollowers">' + \ '/newfollowers" tabindex="9">' + \
'<img loading="lazy" decoding="async" src="/' + \ '<img loading="lazy" decoding="async" src="/' + \
'icons/newpost.png" title="' + \ 'icons/newpost.png" title="' + \
translate['Create a new post'] + \ translate['Create a new post'] + \
@ -190,7 +194,8 @@ def _html_timeline_new_post(manually_approve_followers: bool,
'" class="timelineicon"/></a>\n' '" class="timelineicon"/></a>\n'
else: else:
new_post_button_str += \ new_post_button_str += \
'<a href="' + users_path + '/newfollowers">' + \ '<a href="' + users_path + \
'/newfollowers" tabindex="9">' + \
'<button class="button"><span>' + \ '<button class="button"><span>' + \
translate['Post'] + '</span></button></a>' translate['Post'] + '</span></button></a>'
return new_post_button_str return new_post_button_str
@ -747,7 +752,8 @@ def html_timeline(css_cache: {}, default_timeline: str,
'<header>\n' + \ '<header>\n' + \
'<a href="/users/' + nickname + '" title="' + \ '<a href="/users/' + nickname + '" title="' + \
translate['Switch to profile view'] + '" alt="' + \ translate['Switch to profile view'] + '" alt="' + \
translate['Switch to profile view'] + '" aria-flowto="containerHeader">\n' translate['Switch to profile view'] + '" ' + \
'aria-flowto="containerHeader" tabindex="1">\n'
tl_str += '<img loading="lazy" decoding="async" ' + \ tl_str += '<img loading="lazy" decoding="async" ' + \
'class="timeline-banner" alt="" ' + \ 'class="timeline-banner" alt="" ' + \
'src="' + users_path + '/' + banner_file + '" /></a>\n' + \ 'src="' + users_path + '/' + banner_file + '" /></a>\n' + \