diff --git a/modules/overlay/overlay-parent.js b/modules/overlay/overlay-parent.js index 8f11df6..ff457bc 100644 --- a/modules/overlay/overlay-parent.js +++ b/modules/overlay/overlay-parent.js @@ -555,7 +555,14 @@ Drupal.overlay.eventhandlerOverrideLink = function (event) { else { // Add the overlay-context state to the link, so "overlay-restore" links // can restore the context. - $target.attr('href', $.param.fragment(href, { 'overlay-context': this.getPath(window.location) + window.location.search })); + if ($target[0].hash) { + // Leave links with an existing fragment alone. Adding an extra + // parameter to a link like "node/1#section-1" breaks the link. + } + else { + // For links with no existing fragment, add the overlay context. + $target.attr('href', $.param.fragment(href, { 'overlay-context': this.getPath(window.location) + window.location.search })); + } // When the link has a destination query parameter and that destination // is an admin link we need to fragmentize it. This will make it reopen