Skip to content

bug: ion-router-link can't link to another page's anchor #19566

Closed

Description

@hormesiel

Bug Report

Ionic version: 4.9.0

Current behavior:
When clicking on a ion-router-link whose href attribute contains a hash (e.g. /catalog#pens) the app doesn't navigate to the /catalog URL, and an error is printed to the console :

image

Expected behavior:
The app should navigate to the /catalog page and scroll down to the #pens anchor.

Related code:

// app-root.tsx

<ion-app>
  <ion-router useHash={false}>
    <ion-route url='/' component='home-page' />
    <ion-route url='/catalog' component='catalog-page' />
  </ion-router>

  <ion-nav animated={false} />
</ion-app>
// app-footer.tsx

<ion-router-link href='/catalog#pens'>Pens</ion-router-link>

Other information: It's a ionic-pwa Stencil app so I don't have the ionic CLI to provide additional info.

Activity

  1. changed the title [-]bug: [/-] [+]bug: `ion-router-link` can't link to another page's anchor[/+] on Oct 7, 2019
  2. self-assigned this
    on Feb 7, 2022
  3. averyrousseau commented on Feb 7, 2022

    @averyrousseau
    Contributor

    Thanks for the issue! It looks like this is still happening in Ionic 6. While ion-router-link has since been deprecated for all except vanilla JS or Stencil projects, I'm still able to replicate the issue in core.

    This issue is somewhat related, but I believe the fixes will be separate: #19365

  4. removed their assignment
    on Feb 7, 2022
  5. added a commit that references this issue on May 28, 2026
    a982516
  6. ShaneK commented on Jun 3, 2026

    @ShaneK
    Member

    Hey! The fix for this has been released as part of v8.8.9. Thanks for the report!

  7. ionitron-bot commented on Jul 3, 2026

    @ionitron-bot

    Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

  8. locked and limited conversation to collaborators on Jul 3, 2026
  9. added a commit that references this issue on Oct 3, 2026
    8dd4f58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Fields

    Stage

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions