1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-23 23:32:40 +01:00
phorge-phorge/webroot/rsrc/js/phui/behavior-phui-object-box-tabs.js
Bob Trahan d18ba3f004 Fix tabs losing scroll position
Summary: we were missing an e.kill().  Fixes T5754.

Test Plan: looked at a file and selected different tabs - pre-patch vertical position lost and post patch vertical position preserved!

Reviewers: chad, epriestley

Reviewed By: epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T5754

Differential Revision: https://secure.phabricator.com/D10111
2014-08-01 12:29:48 -07:00

37 lines
916 B
JavaScript

/**
* @provides javelin-behavior-phui-object-box-tabs
* @requires javelin-behavior
* javelin-stratcom
* javelin-dom
*/
JX.behavior('phui-object-box-tabs', function() {
JX.Stratcom.listen(
'click',
'phui-object-box-tab',
function (e) {
e.kill();
var key = e.getNodeData('phui-object-box-tab').tabKey;
var map = e.getNodeData('phui-object-box').tabMap;
var tab = e.getNode('phui-object-box-tab');
var box = e.getNode('phui-object-box');
var tabs = JX.DOM.scry(box, 'li', 'phui-object-box-tab');
for (var ii = 0; ii < tabs.length; ii++) {
JX.DOM.alterClass(
tabs[ii],
'phui-list-item-selected',
(tabs[ii] == tab));
}
for (var k in map) {
if (k == key) {
JX.DOM.show(JX.$(map[k]));
} else {
JX.DOM.hide(JX.$(map[k]));
}
}
});
});