1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 00:42:41 +01:00

lose help cursor on blur

Summary:
Fixes T8501.
When losing focus while holding ctrl, we never get a key-up event; ctrl-f/d/tab make the browser tab lose focus.
So treat 'blur' (unfocus) as if the user released ctrl.

Test Plan: ctrl-f/ctrl-d/ctrl-tab, ctrl-click-outside-of-window, and move mouse over the content - see no help suggestions.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley

Maniphest Tasks: T8501

Differential Revision: https://secure.phabricator.com/D13260
This commit is contained in:
Aviv Eyal 2015-08-27 04:15:40 -07:00 committed by epriestley
parent 55b44f53f8
commit 960a574dd5
2 changed files with 35 additions and 17 deletions

View file

@ -11,7 +11,7 @@ return array(
'core.pkg.js' => 'a590b451',
'darkconsole.pkg.js' => 'e7393ebb',
'differential.pkg.css' => '2de124c9',
'differential.pkg.js' => 'ebef29b1',
'differential.pkg.js' => 'fd95c208',
'diffusion.pkg.css' => '385e85b3',
'diffusion.pkg.js' => '0115b37c',
'maniphest.pkg.css' => '4845691a',
@ -407,7 +407,7 @@ return array(
'rsrc/js/application/releeph/releeph-preview-branch.js' => 'b2b4fbaf',
'rsrc/js/application/releeph/releeph-request-state-change.js' => 'a0b57eb8',
'rsrc/js/application/releeph/releeph-request-typeahead.js' => 'de2e896f',
'rsrc/js/application/repository/repository-crossreference.js' => 'bea81850',
'rsrc/js/application/repository/repository-crossreference.js' => 'e9eeb416',
'rsrc/js/application/search/behavior-reorder-queries.js' => 'e9581f08',
'rsrc/js/application/slowvote/behavior-slowvote-embed.js' => '887ad43f',
'rsrc/js/application/transactions/behavior-show-older-transactions.js' => 'dbbf48b6',
@ -643,7 +643,7 @@ return array(
'javelin-behavior-remarkup-preview' => 'f7379f45',
'javelin-behavior-reorder-applications' => '76b9fc3e',
'javelin-behavior-reorder-columns' => 'e1d25dfb',
'javelin-behavior-repository-crossreference' => 'bea81850',
'javelin-behavior-repository-crossreference' => 'e9eeb416',
'javelin-behavior-scrollbar' => '834a1173',
'javelin-behavior-search-reorder-queries' => 'e9581f08',
'javelin-behavior-select-on-click' => '4e3e79a6',
@ -1745,12 +1745,6 @@ return array(
'javelin-util',
'phabricator-shaped-request',
),
'bea81850' => array(
'javelin-behavior',
'javelin-dom',
'javelin-stratcom',
'javelin-uri',
),
'c1700f6f' => array(
'javelin-install',
'javelin-util',
@ -1913,6 +1907,12 @@ return array(
'javelin-dom',
'phabricator-draggable-list',
),
'e9eeb416' => array(
'javelin-behavior',
'javelin-dom',
'javelin-stratcom',
'javelin-uri',
),
'ea681761' => array(
'javelin-behavior',
'javelin-aphlict',

View file

@ -40,8 +40,7 @@ JX.behavior('repository-crossreference', function(config, statics) {
'tag:span',
function(e) {
if (e.getType() === 'mouseout') {
highlighted && JX.DOM.alterClass(highlighted, classHighlight, false);
highlighted = null;
unhighlight();
return;
}
if (!isSignalkey(e)) {
@ -63,6 +62,10 @@ JX.behavior('repository-crossreference', function(config, statics) {
}
});
}
function unhighlight() {
highlighted && JX.DOM.alterClass(highlighted, classHighlight, false);
highlighted = null;
}
function openSearch(target, lang) {
var symbol = target.textContent || target.innerText;
@ -110,6 +113,7 @@ JX.behavior('repository-crossreference', function(config, statics) {
linkAll(e.getData().container);
});
JX.Stratcom.listen(
['keydown', 'keyup'],
null,
@ -117,14 +121,28 @@ JX.behavior('repository-crossreference', function(config, statics) {
if (e.getRawEvent().keyCode !== signalKey) {
return;
}
statics.active = (e.getType() === 'keydown');
linked.forEach(function(element) {
JX.DOM.alterClass(element, classMouseCursor, statics.active);
});
setCursorMode(e.getType() === 'keydown');
if (!statics.active) {
highlighted && JX.DOM.alterClass(highlighted, classHighlight, false);
highlighted = null;
unhighlight();
}
});
JX.Stratcom.listen(
'blur',
null,
function(e) {
if (e.getTarget()) {
return;
}
unhighlight();
setCursorMode(false);
});
function setCursorMode(active) {
statics.active = active;
linked.forEach(function(element) {
JX.DOM.alterClass(element, classMouseCursor, statics.active);
});
}
});