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

Hide dropdown menus when users click workflow items

Summary:
In D16157, dropdown menus got an overly-broad check for not closing when an item is clicked.

Specifically, we don't want to close the menu if the item is really opening a submenu, like "Edit Related Objects..." does on mobile.

The check for this is too broad, and also doesn't close the menu if the item has workflow.

Instead, use a narrower check.

Test Plan:
  - Menu still stays open when toggling submenus like "Edit Related Objects".
  - Menu now closes properly when using workflow items like "Edit Comment" or "Remove Comment".

Reviewers: chad

Reviewed By: chad

Differential Revision: https://secure.phabricator.com/D17210
This commit is contained in:
epriestley 2017-01-16 13:31:04 -08:00
parent 903e37a21b
commit a4a9485612
3 changed files with 32 additions and 25 deletions

View file

@ -10,7 +10,7 @@ return array(
'conpherence.pkg.css' => '0b64e988',
'conpherence.pkg.js' => '6249a1cf',
'core.pkg.css' => '1afa1d13',
'core.pkg.js' => 'a2ead3fe',
'core.pkg.js' => '892976d4',
'darkconsole.pkg.js' => 'e7393ebb',
'differential.pkg.css' => '9535a7e6',
'differential.pkg.js' => 'ddfeb49b',
@ -533,7 +533,7 @@ return array(
'rsrc/js/core/behavior-watch-anchor.js' => '9f36c42d',
'rsrc/js/core/behavior-workflow.js' => '0a3f3021',
'rsrc/js/core/phtize.js' => 'd254d646',
'rsrc/js/phui/behavior-phui-dropdown-menu.js' => '1aa4c968',
'rsrc/js/phui/behavior-phui-dropdown-menu.js' => '8744dfd1',
'rsrc/js/phui/behavior-phui-file-upload.js' => 'b003d4fb',
'rsrc/js/phui/behavior-phui-submenu.js' => 'a6f7a73b',
'rsrc/js/phui/behavior-phui-tab-group.js' => '0a0b10e9',
@ -686,7 +686,7 @@ return array(
'javelin-behavior-phabricator-watch-anchor' => '9f36c42d',
'javelin-behavior-pholio-mock-edit' => 'bee502c8',
'javelin-behavior-pholio-mock-view' => 'fbe497e7',
'javelin-behavior-phui-dropdown-menu' => '1aa4c968',
'javelin-behavior-phui-dropdown-menu' => '8744dfd1',
'javelin-behavior-phui-file-upload' => 'b003d4fb',
'javelin-behavior-phui-hovercards' => 'bcaccd64',
'javelin-behavior-phui-submenu' => 'a6f7a73b',
@ -1057,12 +1057,6 @@ return array(
'19f9369b' => array(
'phui-oi-list-view-css',
),
'1aa4c968' => array(
'javelin-behavior',
'javelin-stratcom',
'javelin-dom',
'phuix-dropdown-menu',
),
'1ad0a787' => array(
'javelin-install',
'javelin-reactor',
@ -1573,6 +1567,12 @@ return array(
'phabricator-tooltip',
'changeset-view-manager',
),
'8744dfd1' => array(
'javelin-behavior',
'javelin-stratcom',
'javelin-dom',
'phuix-dropdown-menu',
),
'88236f00' => array(
'javelin-behavior',
'phabricator-keyboard-shortcut',

View file

@ -173,22 +173,26 @@ final class PhabricatorActionView extends AphrontView {
->setIcon($this->icon.$color);
}
$sigils = array();
if ($this->workflow) {
$sigils[] = 'workflow';
}
if ($this->download) {
$sigils[] = 'download';
}
if ($this->submenu) {
$sigils[] = 'keep-open';
}
if ($this->sigils) {
$sigils = array_merge($sigils, $this->sigils);
}
$sigils = $sigils ? implode(' ', $sigils) : null;
if ($this->href) {
$sigils = array();
if ($this->workflow) {
$sigils[] = 'workflow';
}
if ($this->download) {
$sigils[] = 'download';
}
if ($this->sigils) {
$sigils = array_merge($sigils, $this->sigils);
}
$sigils = $sigils ? implode(' ', $sigils) : null;
if ($this->renderAsForm) {
if (!$this->hasViewer()) {
throw new Exception(
@ -248,6 +252,7 @@ final class PhabricatorActionView extends AphrontView {
'span',
array(
'class' => 'phabricator-action-view-item',
'sigil' => $sigils,
),
array($icon, $this->name));
}

View file

@ -48,7 +48,9 @@ JX.behavior('phui-dropdown-menu', function() {
return;
}
if (JX.Stratcom.pass()) {
// If this item opens a submenu, we don't want to close the current
// menu. One submenu is "Edit Related Objects..." on mobile.
if (JX.Stratcom.hasSigil(e.getTarget(), 'keep-open')) {
return;
}