Shopify / shopify-app-bridge

https://shopify.dev/docs/api/app-bridge
86 stars 9 forks source link

NavMenu incorrectly highlighting menu item for nested child path #392

Open dsychin opened 3 months ago

dsychin commented 3 months ago

Describe the bug

NavMenu will highlight child paths with the same name even if it is not at the app's root path.

To Reproduce

NavMenu is set to the following paths:

For most of the app, Home will be shown as highlighted which is fine.

If the current path is a child of /settings such as /settings/path/to/page then Settings is highlighted, this is also fine.

The problem occurs when you have a path that contains the same text as one of the NavMenu item such as /path/to/settings which is not a child path of Settings but will show Settings as highlighted because it contains Settings in the path.

Expected behaviour

I think the intended behaviour in this case should be that Home is highlighted since this is not a child path of Settings.

Contextual information

Packages and versions

Platform

Additional context

My app is using React with the App Bridge React library.