Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

navbar_alerts: Fix navbar alerts inaccessibility.

shanukunaa6f2b13109c
diff --git a/static/js/panels.js b/static/js/panels.js
index 946d791b40f..050ef6562f2 100644
--- a/static/js/panels.js
+++ b/static/js/panels.js
@@ -116,6 +116,14 @@ exports.initialize = function () {
}
resize_app();
});
+
+ // Treat Enter with links in the panels UI focused like a click.,
+ $("#panels").on("keyup", ".alert-link[role=button]", function (e) {
+ e.stopPropagation();
+ if (e.key === "Enter") {
+ $(this).click();
+ }
+ });
};
exports.open = function ($process) {
diff --git a/templates/zerver/app/navbar_alerts.html b/templates/zerver/app/navbar_alerts.html
index 3ae522be047..23d2d051e2b 100644
--- a/templates/zerver/app/navbar_alerts.html
+++ b/templates/zerver/app/navbar_alerts.html
@@ -1,24 +1,24 @@
<div id="panels">
<div data-process="notifications" class="alert alert-info">
- <span class="close" data-dismiss="alert" aria-label="{{ _('Close') }}">&times;</span>
+ <span class="close" data-dismiss="alert" aria-label="{{ _('Close') }}" role="button" tabindex=0>&times;</span>
<div data-step="1">
{% trans %}Zulip needs your permission to
- <a class="request-desktop-notifications alert-link">enable desktop notifications.</a>
+ <a class="request-desktop-notifications alert-link" role="button" tabindex=0>enable desktop notifications.</a>
{% endtrans %}
</div>
<div data-step="2" style="display: none">
{{ _('We strongly recommend enabling desktop notifications. They help Zulip keep your team connected.') }}
<span class="buttons">
- <a class="alert-link request-desktop-notifications">{{ _('Enable notifications') }}</a>
+ <a class="alert-link request-desktop-notifications" role="button" tabindex=0>{{ _('Enable notifications') }}</a>
&bull;
- <a class="alert-link exit">{{ _('Ask me later') }}</a>
+ <a class="alert-link exit" role="button" tabindex=0>{{ _('Ask me later') }}</a>
&bull;
- <a class="alert-link reject-notifications">{{ _('Never ask on this computer') }}</a>
+ <a class="alert-link reject-notifications" role="button" tabindex=0>{{ _('Never ask on this computer') }}</a>
</span>
</div>
</div>
<div data-process="email-server" class="alert alert-info red">
- <span class="close" data-dismiss="alert" aria-label="{{ _('Close') }}">&times;</span>
+ <span class="close" data-dismiss="alert" aria-label="{{ _('Close') }}" role="button" tabindex=0>&times;</span>
<div data-step="1">
{% trans %}Zulip needs to send email to confirm users' addresses and send notifications.{% endtrans %}
<a class="alert-link" href="https://zulip.readthedocs.io/en/latest/production/email.html" target="_blank" rel="noopener noreferrer">
@@ -27,7 +27,7 @@
</div>
</div>
<div data-process="profile-incomplete" class="alert alert-info">
- <span class="close" data-dismiss="alert" aria-label="{{ _('Close') }}">&times;</span>
+ <span class="close" data-dismiss="alert" aria-label="{{ _('Close') }}" role="button" tabindex=0>&times;</span>
<div data-step="2">
{% trans %}
Complete the
@@ -38,7 +38,7 @@
</div>
</div>
<div data-process="insecure-desktop-app" class="alert alert-info red">
- <span class="close" data-dismiss="alert" aria-label="{{ _('Close') }}">&times;</span>
+ <span class="close" data-dismiss="alert" aria-label="{{ _('Close') }}" role="button" tabindex=0>&times;</span>
<div data-step="1">
{% trans apps_page_link="https://zulip.com/apps" %}
You are using an old version of the Zulip desktop app with known security bugs.
@@ -49,14 +49,14 @@
</div>
</div>
<div data-process="bankruptcy" class="alert alert-info brankruptcy">
- <span class="close" data-dismiss="alert" aria-label="{{ _('Close') }}">&times;</span>
+ <span class="close" data-dismiss="alert" aria-label="{{ _('Close') }}" role="button" tabindex=0>&times;</span>
<div data-step="1">
{% trans count=page_params.unread_msgs.count %}
Welcome back! You have <span class="bankruptcy_unread_count">{{ count }}</span> unread messages. Do you want to mark them all as read?
<span class="buttons">
- <a class="alert-link accept-bankruptcy">Yes, please!</a>
+ <a class="alert-link accept-bankruptcy" role="button" tabindex=0>Yes, please!</a>
&bull;
- <a class="alert-link exit">No, I'll catch up.</a>
+ <a class="alert-link exit" role="button" tabindex=0>No, I'll catch up.</a>
</span>
{% endtrans %}
</div>