Skip to content

bug: Vue: Incorrect href [object Object] when using router-link object #30848

@comandos

Description

@comandos

Prerequisites

Ionic Framework Version

v8.x

Current Behavior

When using the router-link attribute on Ionic Vue components (e.g. <ion-button>, <ion-item>), and passing a Vue Router location object such as:

<ion-button :router-link="{ name: 'details' }">Details</ion-button>

the component navigates correctly, but the generated DOM contains incorrect href values.

Both the host element and the internal Shadow DOM anchor render [object Object] instead of the resolved URL.

Example rendered output:

<ion-button routerlink="[object Object]">
  <template shadowrootmode="open">
    <a href="[object Object]" class="button-native">
      <span class="button-inner">...</span>
    </a>
  </template>
  Details
</ion-button>

This results in:

  • Browser status bar showing [object Object] on hover
  • Incorrect link preview for assistive technologies
  • No way to know the actual target URL from DOM
  • Real href never being exposed, navigation works only via JS event interception

Expected Behavior

Ionic should resolve { name: 'details' } into the actual route URL (e.g. /details) and reflect it either:

  • on the host element (routerlink="/details")
  • or on the internal <a> element inside Shadow DOM (href="/details")

So that:

  • browser hover shows the correct URL
  • accessibility tools detect the correct destination
  • the link behaves like a normal anchor
  • DOM correctly represents the navigation target

Steps to Reproduce

  1. Create an Ionic Vue project.
  2. Add a component using router-link with an object:
<ion-button :router-link="{ name: 'details' }">
  Details
</ion-button>
  1. Hover over the component.
  2. Inspect the DOM.

Result: both the routerlink attribute and the internal <a href> contain [object Object]

Code Reproduction URL

https://v6ckjp.csb.app/

Ionic Info

Ionic:

   Ionic CLI       : 7.2.1
   Ionic Framework : @ionic/vue 8.7.11

Capacitor:

   Capacitor CLI      : 7.4.4
   @capacitor/android : 7.4.4
   @capacitor/core    : 7.4.4
   @capacitor/ios     : 7.4.4

Utility:

   cordova-res : not installed globally
   native-run  : 2.0.1

System:

   NodeJS : v22.13.1
   npm    : 10.9.2
   OS     : Linux 6.8

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions