Skip to content

data-enhance-nav="false" still triggers fetch calls for same-page anchors #63396

@zubairkhakwani

Description

@zubairkhakwani

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

When data-enhance-nav="false" is set on the navigation container, clicking an anchor tag that references an element on the same page (e.g., / → /#contact-us) still triggers an unnecessary fetch call.

This is inconsistent with the documented/expected behavior where disabling enhanced navigation should prevent such fetches and allow normal browser navigation/scrolling to anchors.

Steps to Reproduce

  1. Add a navigation list with data-enhance-nav="false".
  2. On the home page /, click an anchor tag pointing to an element on the same page, such as /#contact-us.
  3. Observe in network tab that a fetch request is still made.

Actual Behavior

  • Fetch calls are triggered even when navigating to an anchor within the same page.

Expected Behavior

  • With data-enhance-nav="false", navigation to same-page anchors (/#section-id) should not trigger any fetch calls.
  • The browser should handle it natively and just scroll to the element.
  • Only full page navigations (e.g., /download) should cause a reload. (which is working fine)

Additional Notes

When data-enhance-nav="true":

  • It correctly sends fetch calls for separate pages (e.g., /download). (which is working fine)
  • It does not send fetch calls for same-page anchor navigation. (which is working fine)

When data-enhance-nav="false":

  • It works correctly for separate pages (full reload). (which is working fine)
  • But incorrectly still sends fetch calls for same-page anchors. (this is where the issue is)

Expected Behavior

No response

Steps To Reproduce

No response

Exceptions (if any)

No response

.NET Version

9.0.203

Anything else?

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions