Retry failed page anchor navigation

Summary:
When the user loads a page with an anchor on it like #thing, or clicks a link to
#thing, and #thing doesn't exist, keep trying to navigate to #thing for a few
seconds.

This allows anchors to work when the target is in content which is later ajaxed
in. In particular, this affects inline comments in Differential.

Test Plan: Opened inline comment links in a new tab, was in the right place when
I switched tabs.

Reviewers: nh, btrahan, jungejason

Reviewed By: btrahan

CC: aran, btrahan, epriestley

Maniphest Tasks: T492

Differential Revision: https://secure.phabricator.com/D1327
This commit is contained in:
epriestley
2012-01-05 16:36:59 -08:00
parent 9c5a6601d6
commit da3a972400
3 changed files with 67 additions and 33 deletions

View File

@@ -178,10 +178,13 @@ final class DifferentialInlineCommentView extends AphrontView {
}
}
$anchor_name = 'inline-'.$inline->getID();
$anchor = phutil_render_tag(
'a',
array(
'name' => 'inline-'.$inline->getID(),
'name' => $anchor_name,
'id' => $anchor_name,
),
'');