In-page anchor navigation from Forge Custom UI macros updates URL but does not scroll to anchor

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Medium
    • Component/s: Page - View
    • None
    • 1
    • Severity 3 - Minor
    • 1

      Issue Summary

      When a Forge Custom UI macro (such as Advanced Cards | Mosaic by Adaptavist) executes same-page anchor link navigation pointing to an internal heading/anchor, the browser URL updates with the hash fragment, but Confluence does not scroll to the target heading/anchor.

      Steps to Reproduce

      1. Install a Forge Custom UI macro that supports card/link navigation (e.g., Advanced Cards | Mosaic).
      2. 2. Insert the macro on a Confluence page with multiple headings and configure a card to link to a heading anchor on the same page (e.g., `https://<site>.atlassian.net/wiki/spaces/<SPACE>/pages/<PAGE_ID>/Title#Heading-Anchor`).
      3. 3. Publish the page and click the card.

      Expected Results

      The page automatically scrolls down to the targeted heading/anchor.

      Actual Results

      The browser URL bar updates with the `#Heading-Anchor` fragment, but the page remains static and does not scroll to the section.

      Workaround

      • Right-click the card link and select Open link in new tab. * Or click the address bar after clicking the card and press Enter to trigger the native browser scroll.

      Technical Details / Root Cause (from Engineering)

      When a Forge Custom UI macro performs same-page navigation with a hash fragment, the Forge bridge uses `history.push()` via `getBrowserHistory()` (`forge-ui/src/core/Renderer.tsx:138`). This updates the URL but does not trigger scroll-to-anchor behavior because: 1. `ScrollToHashLinkHandler` (`@confluence/scroll`) only intercepts parent-window click events — clicks from Forge iframes don't reach it. 2. `DeepLinkHandler` (`@confluence/deep-link-handler`) doesn't re-fire for hash-only changes on the same route. 3. Browser-native hash scrolling is not triggered by `history.push()`.

       

              Assignee:
              Unassigned
              Reporter:
              Alejandra Herrera
              Votes:
              12 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated: