mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-23 05:50:55 +01:00
If there's an anchor in the URL in Differential, don't stick to the bottom of the page as content loads
Summary: Fixes T11784. A lot of things are interacting here, but this probably gets slightly better results slightly more often? Basically: - When we load content, we try to keep the viewport "stable" on the page, so the page doesn't jump around like crazy. - If you're near the top or bottom of the page, we try to stick to the top (e.g., reading the summary) or bottom (e.g., writing a comment). - But, if you followed an anchor to a comment that's close to the bottom of the page, we might stick to the bottom intead of staying with the anchor. Kind of do a better job by not sticking to the bottom if you have an anchor. This will get things wrong if you follow an anchor, scroll down, start writing a comment, etc. But this whole thing is a pile of guesses anyway. Test Plan: - Followed an anchor, saw non-sticky stabilization. - Loaded the page normally, scrolled to the bottom real fast, saw sticky stabilization. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11784 Differential Revision: https://secure.phabricator.com/D17911
This commit is contained in:
parent
86b9deb8a9
commit
325682248a
2 changed files with 20 additions and 14 deletions
|
@ -13,7 +13,7 @@ return array(
|
||||||
'core.pkg.js' => '8c5f913d',
|
'core.pkg.js' => '8c5f913d',
|
||||||
'darkconsole.pkg.js' => '1f9a31bc',
|
'darkconsole.pkg.js' => '1f9a31bc',
|
||||||
'differential.pkg.css' => '58712637',
|
'differential.pkg.css' => '58712637',
|
||||||
'differential.pkg.js' => 'bd321b6e',
|
'differential.pkg.js' => 'f1b636fb',
|
||||||
'diffusion.pkg.css' => 'b93d9b8c',
|
'diffusion.pkg.css' => 'b93d9b8c',
|
||||||
'diffusion.pkg.js' => '84c8f8fd',
|
'diffusion.pkg.js' => '84c8f8fd',
|
||||||
'favicon.ico' => '30672e08',
|
'favicon.ico' => '30672e08',
|
||||||
|
@ -390,7 +390,7 @@ return array(
|
||||||
'rsrc/js/application/dashboard/behavior-dashboard-move-panels.js' => '408bf173',
|
'rsrc/js/application/dashboard/behavior-dashboard-move-panels.js' => '408bf173',
|
||||||
'rsrc/js/application/dashboard/behavior-dashboard-query-panel-select.js' => '453c5375',
|
'rsrc/js/application/dashboard/behavior-dashboard-query-panel-select.js' => '453c5375',
|
||||||
'rsrc/js/application/dashboard/behavior-dashboard-tab-panel.js' => 'd4eecc63',
|
'rsrc/js/application/dashboard/behavior-dashboard-tab-panel.js' => 'd4eecc63',
|
||||||
'rsrc/js/application/diff/DiffChangeset.js' => '145c34e2',
|
'rsrc/js/application/diff/DiffChangeset.js' => 'c5742feb',
|
||||||
'rsrc/js/application/diff/DiffChangesetList.js' => 'f1101e6e',
|
'rsrc/js/application/diff/DiffChangesetList.js' => 'f1101e6e',
|
||||||
'rsrc/js/application/diff/DiffInline.js' => 'bdf6b568',
|
'rsrc/js/application/diff/DiffInline.js' => 'bdf6b568',
|
||||||
'rsrc/js/application/diff/behavior-preview-link.js' => '051c7832',
|
'rsrc/js/application/diff/behavior-preview-link.js' => '051c7832',
|
||||||
|
@ -779,7 +779,7 @@ return array(
|
||||||
'phabricator-darklog' => 'c8e1ffe3',
|
'phabricator-darklog' => 'c8e1ffe3',
|
||||||
'phabricator-darkmessage' => 'c48cccdd',
|
'phabricator-darkmessage' => 'c48cccdd',
|
||||||
'phabricator-dashboard-css' => 'fe5b1869',
|
'phabricator-dashboard-css' => 'fe5b1869',
|
||||||
'phabricator-diff-changeset' => '145c34e2',
|
'phabricator-diff-changeset' => 'c5742feb',
|
||||||
'phabricator-diff-changeset-list' => 'f1101e6e',
|
'phabricator-diff-changeset-list' => 'f1101e6e',
|
||||||
'phabricator-diff-inline' => 'bdf6b568',
|
'phabricator-diff-inline' => 'bdf6b568',
|
||||||
'phabricator-drag-and-drop-file-upload' => '58dea2fa',
|
'phabricator-drag-and-drop-file-upload' => '58dea2fa',
|
||||||
|
@ -997,17 +997,6 @@ return array(
|
||||||
'javelin-dom',
|
'javelin-dom',
|
||||||
'javelin-typeahead-normalizer',
|
'javelin-typeahead-normalizer',
|
||||||
),
|
),
|
||||||
'145c34e2' => array(
|
|
||||||
'javelin-dom',
|
|
||||||
'javelin-util',
|
|
||||||
'javelin-stratcom',
|
|
||||||
'javelin-install',
|
|
||||||
'javelin-workflow',
|
|
||||||
'javelin-router',
|
|
||||||
'javelin-behavior-device',
|
|
||||||
'javelin-vector',
|
|
||||||
'phabricator-diff-inline',
|
|
||||||
),
|
|
||||||
'1499a8cb' => array(
|
'1499a8cb' => array(
|
||||||
'javelin-behavior',
|
'javelin-behavior',
|
||||||
'javelin-stratcom',
|
'javelin-stratcom',
|
||||||
|
@ -1926,6 +1915,17 @@ return array(
|
||||||
'javelin-stratcom',
|
'javelin-stratcom',
|
||||||
'phabricator-tooltip',
|
'phabricator-tooltip',
|
||||||
),
|
),
|
||||||
|
'c5742feb' => array(
|
||||||
|
'javelin-dom',
|
||||||
|
'javelin-util',
|
||||||
|
'javelin-stratcom',
|
||||||
|
'javelin-install',
|
||||||
|
'javelin-workflow',
|
||||||
|
'javelin-router',
|
||||||
|
'javelin-behavior-device',
|
||||||
|
'javelin-vector',
|
||||||
|
'phabricator-diff-inline',
|
||||||
|
),
|
||||||
'c587b80f' => array(
|
'c587b80f' => array(
|
||||||
'javelin-install',
|
'javelin-install',
|
||||||
),
|
),
|
||||||
|
|
|
@ -440,6 +440,12 @@ JX.install('DiffChangeset', {
|
||||||
var near_top = (old_pos.y <= sticky);
|
var near_top = (old_pos.y <= sticky);
|
||||||
var near_bot = ((old_pos.y + old_view.y) >= (old_dim.y - sticky));
|
var near_bot = ((old_pos.y + old_view.y) >= (old_dim.y - sticky));
|
||||||
|
|
||||||
|
// If we have an anchor in the URL, never stick to the bottom of the
|
||||||
|
// page. See T11784 for discussion.
|
||||||
|
if (window.location.hash) {
|
||||||
|
near_bot = false;
|
||||||
|
}
|
||||||
|
|
||||||
var target_pos = JX.Vector.getPos(target);
|
var target_pos = JX.Vector.getPos(target);
|
||||||
var target_dim = JX.Vector.getDim(target);
|
var target_dim = JX.Vector.getDim(target);
|
||||||
var target_mid = (target_pos.y + (target_dim.y / 2));
|
var target_mid = (target_pos.y + (target_dim.y / 2));
|
||||||
|
|
Loading…
Reference in a new issue