router.navigate doesn't scroll to anchor when navigating to Confluence page URL from Forge macro

XMLWordPrintable

    • 1
    • Severity 3 - Minor
    • 1

      Issue Summary

      When calling router.navigate (from @forge/bridge) with a Confluence page URL that includes an anchor from inside a Forge macro, the page loads successfully but fails to scroll to the location specified by the anchor.

      Steps to Reproduce

      1. Create a Forge macro in Confluence with the following manifest configuration:
        macro:     
            - key: test-anchor-macro
              resource: main
              render: native
              resolver:         
                function: resolver
              title: Test Anchor Navigation
              description: Test macro for anchor navigation
        
      1. Add a button or similar UI element that calls router.navigate with a Confluence page URL containing an anchor
      2. Use code similar to the following example:
        const handleNavigateClick = () => {
          router.navigate("https://example.atlassian.net/wiki/spaces/MYSPACE/pages/123456789/Page+Title#heading-anchor");
        };
        
      1. Click the button to trigger navigation
      2. Observe the page navigation behavior

      Expected Results

      The Confluence page should load in the current tab and automatically scroll to the position indicated by the anchor in the URL, bringing the anchored section into focus.

      Actual Results

      The Confluence page loads correctly, but the page does not scroll to the anchor location. The user remains at the top of the page instead of being scrolled to the targeted section.

      Workaround

      The issue happens only with router.navigate, if you update the macro body to directly include the link instead, then clicking the link seems to work and scroll to the desired location.

              Assignee:
              Unassigned
              Reporter:
              Nashid Farhad (Inactive)
              Votes:
              23 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated: