js: Add tabindex attribute for anchor tag to allow focus.

This adds tabindex='0' in anchor tags for allowing the message menu
popover box to be focusable using hotkey 'i' through keyboard.

This is a necessary follow up to
729c09074a, which removed the href
attribute from anchor tags to which click-handlers were attached,
which resulted in making them non-focusable as jQuery doesn't allow
anchor tags to be focusable without tab-index or href attribute.

Fixes #21125.
This commit is contained in:
jai2201 2022-02-15 02:04:58 +05:30 committed by Tim Abbott
parent 36b208ad51
commit 44bd6cafb7
10 changed files with 28 additions and 28 deletions

View File

@ -2,7 +2,7 @@
<ul class="nav nav-list actions_popover"> <ul class="nav nav-list actions_popover">
{{#if should_display_hide_option}} {{#if should_display_hide_option}}
<li> <li>
<a class="rehide_muted_user_message" data-message-id="{{message_id}}"> <a class="rehide_muted_user_message" data-message-id="{{message_id}}" tabindex="0">
<i class="fa fa-eye-slash" aria-hidden="true"></i> <i class="fa fa-eye-slash" aria-hidden="true"></i>
{{t "Hide muted message again" }} {{t "Hide muted message again" }}
</a> </a>
@ -11,7 +11,7 @@
{{#if should_display_edit_and_view_source}} {{#if should_display_edit_and_view_source}}
<li> <li>
<a class="popover_edit_message" data-message-id="{{message_id}}"> <a class="popover_edit_message" data-message-id="{{message_id}}" tabindex="0">
<i class="{{#if use_edit_icon}}fa fa-pencil{{else}}fa fa-file-code-o{{/if}}" aria-hidden="true"></i> {{editability_menu_item}} <i class="{{#if use_edit_icon}}fa fa-pencil{{else}}fa fa-file-code-o{{/if}}" aria-hidden="true"></i> {{editability_menu_item}}
<span class="hotkey-hint">(e)</span> <span class="hotkey-hint">(e)</span>
</a> </a>
@ -20,7 +20,7 @@
{{#if should_display_quote_and_reply}} {{#if should_display_quote_and_reply}}
<li> <li>
<a class="respond_button" data-message-id="{{message_id}}"> <a class="respond_button" data-message-id="{{message_id}}" tabindex="0">
<i class="fa fa-reply" aria-hidden="true"></i> {{t "Quote and reply or forward" }} <i class="fa fa-reply" aria-hidden="true"></i> {{t "Quote and reply or forward" }}
<span class="hotkey-hint">(>)</span> <span class="hotkey-hint">(>)</span>
</a> </a>
@ -29,7 +29,7 @@
{{#if should_display_reminder_option}} {{#if should_display_reminder_option}}
<li> <li>
<a class='reminder_button' data-message-id="{{message_id}}"> <a class='reminder_button' data-message-id="{{message_id}}" tabindex="0">
<i class="fa fa-bell" aria-hidden="true"></i> {{t "Remind me about this" }} <i class="fa fa-bell" aria-hidden="true"></i> {{t "Remind me about this" }}
</a> </a>
</li> </li>
@ -37,7 +37,7 @@
{{#if should_display_collapse}} {{#if should_display_collapse}}
<li> <li>
<a class="popover_toggle_collapse" data-message-id="{{message_id}}"> <a class="popover_toggle_collapse" data-message-id="{{message_id}}" tabindex="0">
<i class="fa fa-minus" aria-hidden="true"></i> <i class="fa fa-minus" aria-hidden="true"></i>
{{t "Collapse" }} <span class="hotkey-hint">()</span> {{t "Collapse" }} <span class="hotkey-hint">()</span>
</a> </a>
@ -46,7 +46,7 @@
{{#if should_display_uncollapse}} {{#if should_display_uncollapse}}
<li> <li>
<a class="popover_toggle_collapse" data-message-id="{{message_id}}"> <a class="popover_toggle_collapse" data-message-id="{{message_id}}" tabindex="0">
<i class="fa fa-plus" aria-hidden="true"></i> <i class="fa fa-plus" aria-hidden="true"></i>
{{t "Un-collapse" }} <span class="hotkey-hint">()</span> {{t "Un-collapse" }} <span class="hotkey-hint">()</span>
</a> </a>
@ -55,7 +55,7 @@
{{#if should_display_edit_history_option}} {{#if should_display_edit_history_option}}
<li> <li>
<a class="view_edit_history" data-message-id="{{message_id}}"> <a class="view_edit_history" data-message-id="{{message_id}}" tabindex="0">
<i class="fa fa-clock-o" aria-hidden="true"></i> <i class="fa fa-clock-o" aria-hidden="true"></i>
{{t "View edit history" }} {{t "View edit history" }}
</a> </a>
@ -63,7 +63,7 @@
{{/if}} {{/if}}
{{#if should_display_delete_option}} {{#if should_display_delete_option}}
<li> <li>
<a class="delete_message" data-message-id="{{message_id}}"> <a class="delete_message" data-message-id="{{message_id}}" tabindex="0">
<i class="fa fa-times" aria-hidden="true"></i> <i class="fa fa-times" aria-hidden="true"></i>
{{t "Delete message" }} {{t "Delete message" }}
</a> </a>
@ -71,7 +71,7 @@
{{/if}} {{/if}}
{{#if can_mute_topic}} {{#if can_mute_topic}}
<li> <li>
<a class="popover_mute_topic" data-msg-stream-id="{{stream_id}}" data-msg-topic="{{topic}}"> <a class="popover_mute_topic" data-msg-stream-id="{{stream_id}}" data-msg-topic="{{topic}}" tabindex="0">
<i class="fa fa-bell-slash" aria-hidden="true"></i> <i class="fa fa-bell-slash" aria-hidden="true"></i>
{{#tr}}Mute the topic <b>{topic}</b>{{/tr}} <span class="hotkey-hint">(M)</span> {{#tr}}Mute the topic <b>{topic}</b>{{/tr}} <span class="hotkey-hint">(M)</span>
</a> </a>
@ -80,7 +80,7 @@
{{#if can_unmute_topic}} {{#if can_unmute_topic}}
<li> <li>
<a class="popover_unmute_topic" data-msg-stream-id="{{stream_id}}" data-msg-topic="{{topic}}"> <a class="popover_unmute_topic" data-msg-stream-id="{{stream_id}}" data-msg-topic="{{topic}}" tabindex="0">
<i class="fa fa-bell" aria-hidden="true"></i> <i class="fa fa-bell" aria-hidden="true"></i>
{{#tr}}Unmute the topic <b>{topic}</b>{{/tr}} {{#tr}}Unmute the topic <b>{topic}</b>{{/tr}}
</a> </a>
@ -89,7 +89,7 @@
{{#if should_display_add_reaction_option}} {{#if should_display_add_reaction_option}}
<li> <li>
<a class="reaction_button" data-message-id="{{message_id}}"> <a class="reaction_button" data-message-id="{{message_id}}" tabindex="0">
<i class="fa fa-smile-o" aria-hidden="true"></i> <i class="fa fa-smile-o" aria-hidden="true"></i>
{{#tr}}Add emoji reaction{{/tr}} {{#tr}}Add emoji reaction{{/tr}}
</a> </a>
@ -97,7 +97,7 @@
{{/if}} {{/if}}
<li> <li>
<a class="copy_link" data-message-id="{{message_id}}" data-clipboard-text="{{ conversation_time_uri }}"> <a class="copy_link" data-message-id="{{message_id}}" data-clipboard-text="{{ conversation_time_uri }}" tabindex="0">
<i class="fa fa-link" aria-hidden="true"></i> {{t "Copy link to message" }} <i class="fa fa-link" aria-hidden="true"></i> {{t "Copy link to message" }}
</a> </a>
</li> </li>

View File

@ -1,6 +1,6 @@
<ul class="nav" role="navigation"> <ul class="nav" role="navigation">
<li class="dropdown actual-dropdown-menu" id="gear-menu"> <li class="dropdown actual-dropdown-menu" id="gear-menu">
<a id="settings-dropdown" role="button" class="dropdown-toggle" data-target="nada" data-toggle="dropdown" title="{{t 'Menu' }} (g)"> <a id="settings-dropdown" tabindex="0" role="button" class="dropdown-toggle" data-target="nada" data-toggle="dropdown" title="{{t 'Menu' }} (g)">
<i class="fa fa-cog settings-dropdown-cog" aria-hidden="true"></i> <i class="fa fa-cog settings-dropdown-cog" aria-hidden="true"></i>
</a> </a>
<ul class="dropdown-menu" role="menu" aria-labelledby="settings-dropdown"> <ul class="dropdown-menu" role="menu" aria-labelledby="settings-dropdown">

View File

@ -83,7 +83,7 @@
</div> </div>
</div> </div>
<div id="topics_header"> <div id="topics_header">
<a class="show-all-streams"> <i class="fa fa-chevron-left" aria-hidden="true"></i>{{t 'Back to streams' }}</a> <a class="show-all-streams" tabindex="0"> <i class="fa fa-chevron-left" aria-hidden="true"></i>{{t 'Back to streams' }}</a>
</div> </div>
<div id="stream-filters-container" class="scrolling_list" data-simplebar> <div id="stream-filters-container" class="scrolling_list" data-simplebar>
<ul id="stream_filters" class="filters"></ul> <ul id="stream_filters" class="filters"></ul>

View File

@ -1,6 +1,6 @@
<li class="topic-list-item show-more-topics bottom_left_row {{#unless more_topics_unreads}}zero-topic-unreads{{/unless}}"> <li class="topic-list-item show-more-topics bottom_left_row {{#unless more_topics_unreads}}zero-topic-unreads{{/unless}}">
<span class='topic-box'> <span class='topic-box'>
<a class="topic-name">{{t "more topics" }}</a> <a class="topic-name" tabindex="0">{{t "more topics" }}</a>
<span class="unread_count {{#unless more_topics_unreads}}zero_count{{/unless}}"> <span class="unread_count {{#unless more_topics_unreads}}zero_count{{/unless}}">
{{more_topics_unreads}} {{more_topics_unreads}}
</span> </span>

View File

@ -8,7 +8,7 @@
<div class="column-middle" id="navbar-middle"> <div class="column-middle" id="navbar-middle">
<div class="column-middle-inner"> <div class="column-middle-inner">
<div id="streamlist-toggle" {{#if embedded}}class="hide-streamlist-toggle-visibility"{{/if}} title="{{t 'Stream list' }} (q)"> <div id="streamlist-toggle" {{#if embedded}}class="hide-streamlist-toggle-visibility"{{/if}} title="{{t 'Stream list' }} (q)">
<a id="streamlist-toggle-button" role="button"><i class="fa fa-reorder" aria-hidden="true"></i> <a id="streamlist-toggle-button" role="button" tabindex="0"><i class="fa fa-reorder" aria-hidden="true"></i>
<span id="streamlist-toggle-unreadcount">0</span> <span id="streamlist-toggle-unreadcount">0</span>
</a> </a>
</div> </div>
@ -46,7 +46,7 @@
</div> </div>
<div class="column-right"> <div class="column-right">
<div id="userlist-toggle" title="{{t 'User list' }} (w)"> <div id="userlist-toggle" title="{{t 'User list' }} (w)">
<a id="userlist-toggle-button" role="button"><i class="fa fa-group" aria-hidden="true"></i> <a id="userlist-toggle-button" role="button" tabindex="0"><i class="fa fa-group" aria-hidden="true"></i>
<span id="userlist-toggle-unreadcount">0</span> <span id="userlist-toggle-unreadcount">0</span>
</a> </a>
</div> </div>

View File

@ -1,37 +1,37 @@
{{! Contents of the "remind me about this actions" popup }} {{! Contents of the "remind me about this actions" popup }}
<ul class="nav nav-list remind_me_popover"> <ul class="nav nav-list remind_me_popover">
<li> <li>
<a class="remind in_20m" data-message-id="{{message.id}}"> <a class="remind in_20m" data-message-id="{{message.id}}" tabindex="0">
{{t "in 20 minutes" }} {{t "in 20 minutes" }}
</a> </a>
</li> </li>
<li> <li>
<a class="remind in_1h" data-message-id="{{message.id}}"> <a class="remind in_1h" data-message-id="{{message.id}}" tabindex="0">
{{t "in 1 hour" }} {{t "in 1 hour" }}
</a> </a>
</li> </li>
<li> <li>
<a class="remind in_3h" data-message-id="{{message.id}}"> <a class="remind in_3h" data-message-id="{{message.id}}" tabindex="0">
{{t "in 3 hours" }} {{t "in 3 hours" }}
</a> </a>
</li> </li>
<li> <li>
<a class="remind tomo" data-message-id="{{message.id}}"> <a class="remind tomo" data-message-id="{{message.id}}" tabindex="0">
{{t "Tomorrow" }} {{t "Tomorrow" }}
</a> </a>
</li> </li>
<li> <li>
<a class="remind nxtw" data-message-id="{{message.id}}"> <a class="remind nxtw" data-message-id="{{message.id}}" tabindex="0">
{{t "Next week" }} {{t "Next week" }}
</a> </a>
</li> </li>
<li> <li>
<a class='remind custom' data-message-id="{{message.id}}"> <a class='remind custom' data-message-id="{{message.id}}" tabindex="0">
{{t "Select date and time" }} {{t "Select date and time" }}
</a> </a>
</li> </li>

View File

@ -14,7 +14,7 @@
{{#if is_admin}} {{#if is_admin}}
<td> <td>
<span class="referred_by"> <span class="referred_by">
<a data-user-id="{{invited_by_user_id}}" class="view_user_profile">{{referrer_name}}</a> <a data-user-id="{{invited_by_user_id}}" class="view_user_profile" tabindex="0">{{referrer_name}}</a>
</span> </span>
</td> </td>
{{/if}} {{/if}}

View File

@ -26,7 +26,7 @@
{{#if no_owner }} {{#if no_owner }}
{{bot_owner_full_name}} {{bot_owner_full_name}}
{{else}} {{else}}
<a data-user-id="{{bot_owner_id}}" class="view_user_profile">{{bot_owner_full_name}}</a> <a data-user-id="{{bot_owner_id}}" class="view_user_profile" tabindex="0">{{bot_owner_full_name}}</a>
{{/if}} {{/if}}
</span> </span>
</td> </td>

View File

@ -23,8 +23,8 @@
<div> <div>
<a draggable="false" class="subs_set_all_users">{{t "Check all" }}</a> | <a draggable="false" class="subs_set_all_users" tabindex="0">{{t "Check all" }}</a> |
<a draggable="false" class="subs_unset_all_users">{{t "Uncheck all" }}</a> <a draggable="false" class="subs_unset_all_users" tabindex="0">{{t "Uncheck all" }}</a>
</div> </div>
<div id="user-checkboxes-simplebar-wrapper" data-simplebar> <div id="user-checkboxes-simplebar-wrapper" data-simplebar>

View File

@ -26,7 +26,7 @@
{{#if has_starred_messages}} {{#if has_starred_messages}}
<li class="hidden-for-spectators"> <li class="hidden-for-spectators">
<a class="sidebar-popover-unstar-all-in-topic" data-stream-id="{{ stream_id }}" data-topic-name="{{ topic_name }}"> <a tabindex="0" class="sidebar-popover-unstar-all-in-topic" data-stream-id="{{ stream_id }}" data-topic-name="{{ topic_name }}">
<i class="fa fa-star-o" aria-hidden="true"></i> <i class="fa fa-star-o" aria-hidden="true"></i>
{{#tr}}Unstar all messages in topic{{/tr}} {{#tr}}Unstar all messages in topic{{/tr}}
</a> </a>