ui-nav-menu home (root) link is not getting active status when clicked

Solved

ui-nav-menu home (root) link is not getting active status when clicked

Giltee
Shopify Partner
17 3 6

I have a problem with the app UI menu, when a sub menu is clicked the first click on the menu will receive the active status but subsequent clicks leave the status in the previous state. My app is using the remix template and I am using the standard setup from the template:

 

Giltee_0-1700164573013.png

 

 

 

 

   <AppProvider isEmbeddedApp apiKey={apiKey}>
      <ui-nav-menu>
        <Link to="/app" rel="home">
          Home
        </Link>
        <Link to="/app/billing">billing</Link>
        <Link to="/app/settings">settings</Link>
        <Link to="/app/help">help</Link>
      </ui-nav-menu>
      <Outlet />
    </AppProvider>

 

 

 

 

From the documentation: 

https://shopify.dev/docs/api/app-bridge-library/reference/navigation-menu

 

ui-nav-menu element

The ui-nav-menu element is available for use in your app. It configures the sidebar navigation menu in the Shopify admin.

The first element is required and used to configure the home route of the app. It is not rendered as a link. It needs to have rel="home" set along with the href set to the root path.

 

While the example in the docs uses anchor tags in the documentation, the app template uses the Link component by default. I do have the rel="home" set on my root path, where am I going wrong here?

Accepted Solution (1)

Giltee
Shopify Partner
17 3 6

This is an accepted solution.

So the documentation is correct. you must use an anchor tag for it to work. not sure why its included in the template.

View solution in original post

Replies 2 (2)

Giltee
Shopify Partner
17 3 6

This is an accepted solution.

So the documentation is correct. you must use an anchor tag for it to work. not sure why its included in the template.

nadinethery
Shopify Partner
19 1 6

Just for follow-up, there's an issue opened in the remix template: 

 

https://github.com/Shopify/shopify-app-template-remix/issues/369