Skip to content

data-enhance-nav=false is ignored on <svg> elements #51440

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
SteveSandersonMS opened this issue Oct 17, 2023 · 4 comments · Fixed by #51706
Closed

data-enhance-nav=false is ignored on <svg> elements #51440

SteveSandersonMS opened this issue Oct 17, 2023 · 4 comments · Fixed by #51706
Assignees
Labels
area-blazor Includes: Blazor, Razor Components bug This issue describes a behavior which is not expected - a bug.

Comments

@SteveSandersonMS
Copy link
Member

Inside NavigationEnhancement.ts, the logic that decides whether to bypass enhanced nav based on the element clicked looks like:

  if (event.target instanceof HTMLElement && !enhancedNavigationIsEnabledForElement(event.target)) {
    return;
  }

It should say Element instead of HTMLElement, because HTMLElement excludes SVGElement. There is no reason why SVG elements should behave differently from HTML elements in this regard.

@SteveSandersonMS SteveSandersonMS added the area-blazor Includes: Blazor, Razor Components label Oct 17, 2023
@MackinnonBuck MackinnonBuck added the bug This issue describes a behavior which is not expected - a bug. label Oct 17, 2023
@MackinnonBuck MackinnonBuck added this to the .NET 9 Planning milestone Oct 17, 2023
@ghost
Copy link

ghost commented Oct 17, 2023

Thanks for contacting us.

We're moving this issue to the .NET 9 Planning milestone for future evaluation / consideration. We would like to keep this around to collect more feedback, which can help us with prioritizing this work. We will re-evaluate this issue, during our next planning meeting(s).
If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues.
To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

@surayya-MS surayya-MS self-assigned this Oct 23, 2023
@surayya-MS surayya-MS changed the title data-enhanced-nav=false is ignored on <svg> elements data-enhance-nav=false is ignored on <svg> elements Oct 27, 2023
@surayya-MS
Copy link
Member

surayya-MS commented Oct 27, 2023

Couldn't repro this bug because of #51705
When I fixed that one this one reproed

@SteveSandersonMS
Copy link
Member Author

SteveSandersonMS commented Oct 27, 2023

@surayya-MS I don't think this is the same as (or blocked by) #51705

The repro is a scenario like the following. Sorry I should have specified it in the original report.

<a href="something" data-enhance-nav="false">
    <svg width="100" height="100">
        <rect width="100" height="100" style="fill:rgb(0,0,255);" />
    </svg>
</a>

Expected: If you click on the SVG, it should do regular (non-enhanced) nav because of data-enhance-nav="false"
Actual: It will ignore data-enhance-nav="false" and do enhanced nav anyway

@surayya-MS
Copy link
Member

surayya-MS commented Oct 27, 2023

This reproed. I'll add this test case

@ghost ghost locked as resolved and limited conversation to collaborators Nov 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components bug This issue describes a behavior which is not expected - a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants