diff --git a/resources/celerity/map.php b/resources/celerity/map.php --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -10,7 +10,7 @@ 'conpherence.pkg.css' => '3c8a0668', 'conpherence.pkg.js' => '020aebcf', 'core.pkg.css' => 'af983028', - 'core.pkg.js' => 'ee320ca2', + 'core.pkg.js' => 'f39ebda8', 'differential.pkg.css' => '8d8360fb', 'differential.pkg.js' => '67e02996', 'diffusion.pkg.css' => '42c75c37', @@ -253,7 +253,7 @@ 'rsrc/externals/javelin/lib/URI.js' => '2e255291', 'rsrc/externals/javelin/lib/Vector.js' => 'e9c80beb', 'rsrc/externals/javelin/lib/WebSocket.js' => 'fdc13e4e', - 'rsrc/externals/javelin/lib/Workflow.js' => '958e9045', + 'rsrc/externals/javelin/lib/Workflow.js' => 'e9c6d3c7', 'rsrc/externals/javelin/lib/__tests__/Cookie.js' => 'ca686f71', 'rsrc/externals/javelin/lib/__tests__/DOM.js' => '4566e249', 'rsrc/externals/javelin/lib/__tests__/JSON.js' => '710377ae', @@ -752,7 +752,7 @@ 'javelin-workboard-header' => '111bfd2d', 'javelin-workboard-header-template' => 'ebe83a6b', 'javelin-workboard-order-template' => '03e8891f', - 'javelin-workflow' => '958e9045', + 'javelin-workflow' => 'e9c6d3c7', 'maniphest-report-css' => '3d53188b', 'maniphest-task-edit-css' => '272daa84', 'maniphest-task-summary-css' => '61d1667e', @@ -1712,17 +1712,6 @@ 'javelin-stratcom', 'javelin-vector', ), - '958e9045' => array( - 'javelin-stratcom', - 'javelin-request', - 'javelin-dom', - 'javelin-vector', - 'javelin-install', - 'javelin-util', - 'javelin-mask', - 'javelin-uri', - 'javelin-routable', - ), '9623adc1' => array( 'javelin-behavior', 'javelin-stratcom', @@ -2107,6 +2096,17 @@ 'phabricator-title', 'phabricator-favicon', ), + 'e9c6d3c7' => array( + 'javelin-stratcom', + 'javelin-request', + 'javelin-dom', + 'javelin-vector', + 'javelin-install', + 'javelin-util', + 'javelin-mask', + 'javelin-uri', + 'javelin-routable', + ), 'e9c80beb' => array( 'javelin-install', 'javelin-event', diff --git a/webroot/rsrc/externals/javelin/lib/Workflow.js b/webroot/rsrc/externals/javelin/lib/Workflow.js --- a/webroot/rsrc/externals/javelin/lib/Workflow.js +++ b/webroot/rsrc/externals/javelin/lib/Workflow.js @@ -75,6 +75,7 @@ var workflow = new JX.Workflow(link.href); return workflow; }, + _push : function(workflow) { JX.Mask.show(); JX.Workflow._stack.push(workflow); @@ -85,16 +86,40 @@ dialog._destroy(); JX.Mask.hide(); }, - disable : function() { - JX.Workflow._disabled = true; - }, - _onbutton : function(event) { + _onlink: function(event) { + // See T13302. When a user clicks a link in a dialog and that link + // triggers a navigation event, we want to close the dialog as though + // they had pressed a button. + + // When Quicksand is enabled, this is particularly relevant because + // the dialog will stay in the foreground while the page content changes + // in the background if we do not dismiss the dialog. + + // If this is a Command-Click, the link will open in a new window. + var is_command = !!event.getRawEvent().metaKey; + if (is_command) { + return; + } - if (JX.Stratcom.pass()) { + var link = event.getNode('tag:a'); + + // If the link is an anchor, or does not go anywhere, ignore the event. + var href = '' + link.href; + if (!href.length || href[0] === '#') { return; } - if (JX.Workflow._disabled) { + // This link will open in a new window. + if (link.target === '_blank') { + return; + } + + // Close the dialog. + JX.Workflow._pop(); + }, + _onbutton : function(event) { + + if (JX.Stratcom.pass()) { return; } @@ -124,9 +149,6 @@ if (JX.Stratcom.pass()) { return; } - if (JX.Workflow._disabled) { - return; - } e.prevent(); var form = e.getNode('jx-dialog'); var button = JX.DOM.find(form, 'button', '__default__'); @@ -313,6 +335,9 @@ [], JX.Workflow._onsyntheticsubmit); + var onlink = JX.Workflow._onlink; + JX.DOM.listen(this._root, 'click', 'tag:a', onlink); + JX.DOM.listen( this._root, 'mousedown', @@ -471,11 +496,6 @@ return; } - if (JX.Workflow._disabled) { - // Workflows are disabled on this page. - return; - } - if (JX.Stratcom.pass()) { // Something else swallowed the event. return;