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.

click_handlers: Don't focus links on middle / right click.

Gittenburge15189b20c9c
diff --git a/static/js/click_handlers.js b/static/js/click_handlers.js
index 55d0f2efcc7..2995c8c58c2 100644
--- a/static/js/click_handlers.js
+++ b/static/js/click_handlers.js
@@ -739,7 +739,17 @@ exports.initialize = function () {
// Chrome focuses an element when dragging it which can be confusing when
// users involuntarily drag something and we show them the focus outline.
- $('body').on('dragstart', (e) => e.target.blur());
+ $('body').on('dragstart', 'a', (e) => e.target.blur());
+
+ // Don't focus links on middle click.
+ $('body').on('mouseup', 'a', (e) => {
+ if (e.which === 2) { // middle click
+ e.target.blur();
+ }
+ });
+
+ // Don't focus links on context menu.
+ $('body').on('contextmenu', 'a', (e) => e.target.blur());
(function () {
const map = {