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

Fix dialog z-index issue

Summary:
Fixes T7081. History here:

  - JX.Scrollbar made the page scroll weird when a dialog came up because it was half-frame and half-document.
  - I made it fully frame-level.
  - But this wasn't really right; a better fix is to make it fully document-level.

Test Plan:
  - Weird scroll on opening dialog is still fixed.
  - iOS Safari no longer puts the mask over the dialog.

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

Maniphest Tasks: T7081

Differential Revision: https://secure.phabricator.com/D11559
This commit is contained in:
epriestley 2015-01-29 07:10:14 -08:00
parent 82f506f175
commit 31c64b6772
2 changed files with 25 additions and 19 deletions

View file

@ -8,7 +8,7 @@
return array( return array(
'names' => array( 'names' => array(
'core.pkg.css' => '8815f87d', 'core.pkg.css' => '8815f87d',
'core.pkg.js' => 'a27c1b62', 'core.pkg.js' => '65e04767',
'darkconsole.pkg.js' => '8ab24e01', 'darkconsole.pkg.js' => '8ab24e01',
'differential.pkg.css' => '8af45893', 'differential.pkg.css' => '8af45893',
'differential.pkg.js' => '7b5a4aa4', 'differential.pkg.js' => '7b5a4aa4',
@ -203,7 +203,7 @@ return array(
'rsrc/externals/javelin/lib/URI.js' => '6eff08aa', 'rsrc/externals/javelin/lib/URI.js' => '6eff08aa',
'rsrc/externals/javelin/lib/Vector.js' => '2caa8fb8', 'rsrc/externals/javelin/lib/Vector.js' => '2caa8fb8',
'rsrc/externals/javelin/lib/WebSocket.js' => '3f840822', 'rsrc/externals/javelin/lib/WebSocket.js' => '3f840822',
'rsrc/externals/javelin/lib/Workflow.js' => 'a2ccdfec', 'rsrc/externals/javelin/lib/Workflow.js' => '84d6aea0',
'rsrc/externals/javelin/lib/__tests__/Cookie.js' => '5ed109e8', 'rsrc/externals/javelin/lib/__tests__/Cookie.js' => '5ed109e8',
'rsrc/externals/javelin/lib/__tests__/DOM.js' => 'c984504b', 'rsrc/externals/javelin/lib/__tests__/DOM.js' => 'c984504b',
'rsrc/externals/javelin/lib/__tests__/JSON.js' => '837a7d68', 'rsrc/externals/javelin/lib/__tests__/JSON.js' => '837a7d68',
@ -691,7 +691,7 @@ return array(
'javelin-view-renderer' => '6c2b09a2', 'javelin-view-renderer' => '6c2b09a2',
'javelin-view-visitor' => 'efe49472', 'javelin-view-visitor' => 'efe49472',
'javelin-websocket' => '3f840822', 'javelin-websocket' => '3f840822',
'javelin-workflow' => 'a2ccdfec', 'javelin-workflow' => '84d6aea0',
'lightbox-attachment-css' => '7acac05d', 'lightbox-attachment-css' => '7acac05d',
'maniphest-batch-editor' => '8f380ebc', 'maniphest-batch-editor' => '8f380ebc',
'maniphest-report-css' => '6fc16517', 'maniphest-report-css' => '6fc16517',
@ -1420,6 +1420,17 @@ return array(
'javelin-workflow', 'javelin-workflow',
'phabricator-draggable-list', 'phabricator-draggable-list',
), ),
'84d6aea0' => array(
'javelin-stratcom',
'javelin-request',
'javelin-dom',
'javelin-vector',
'javelin-install',
'javelin-util',
'javelin-mask',
'javelin-uri',
'javelin-routable',
),
'851f167c' => array( '851f167c' => array(
'javelin-behavior', 'javelin-behavior',
'javelin-aphlict', 'javelin-aphlict',
@ -1579,17 +1590,6 @@ return array(
'javelin-vector', 'javelin-vector',
'javelin-magical-init', 'javelin-magical-init',
), ),
'a2ccdfec' => array(
'javelin-stratcom',
'javelin-request',
'javelin-dom',
'javelin-vector',
'javelin-install',
'javelin-util',
'javelin-mask',
'javelin-uri',
'javelin-routable',
),
'a4ae61bf' => array( 'a4ae61bf' => array(
'javelin-install', 'javelin-install',
'javelin-dom', 'javelin-dom',

View file

@ -172,11 +172,15 @@ JX.install('Workflow', {
[], [],
JX.Workflow._onsyntheticsubmit); JX.Workflow._onsyntheticsubmit);
var frame = JX.DOM.getContentFrame(); // Note that even in the presence of a content frame, we're doing
frame.appendChild(this._root); // everything here at top level: dialogs are fully modal and cover
// the entire window.
document.body.appendChild(this._root);
var d = JX.Vector.getDim(this._root); var d = JX.Vector.getDim(this._root);
var v = JX.Vector.getDim(frame); var v = JX.Vector.getViewport();
var s = JX.Vector.getAggregateScrollForNode(frame); var s = JX.Vector.getScroll();
// Normally, we position dialogs 100px from the top of the screen. // Normally, we position dialogs 100px from the top of the screen.
// Use more space if the dialog is large (at least roughly the size // Use more space if the dialog is large (at least roughly the size
@ -206,7 +210,9 @@ JX.install('Workflow', {
// The `focus()` call may have scrolled the window. Scroll it back to // The `focus()` call may have scrolled the window. Scroll it back to
// where it was before -- we want to focus the control, but not adjust // where it was before -- we want to focus the control, but not adjust
// the scroll position. // the scroll position.
JX.DOM.scrollToPosition(s.x, s.y);
// Dialogs are window-level, so scroll the window explicitly.
window.scrollTo(s.x, s.y);
} else if (this.getHandler()) { } else if (this.getHandler()) {
this.getHandler()(r); this.getHandler()(r);