Skip to content

Commit efc2f02

Browse files
authored
[Blazor][Fixes #14959] Update navlink to perform case-insensitive matches (#14991)
Otherwise the link doesn't get highlighted even though the route matches (routing is case insensitive).
1 parent cad6e06 commit efc2f02

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Components/Web/src/Routing/NavLink.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ private static bool IsStrictlyPrefixWithSeparator(string value, string prefix)
175175
var prefixLength = prefix.Length;
176176
if (value.Length > prefixLength)
177177
{
178-
return value.StartsWith(prefix, StringComparison.Ordinal)
178+
return value.StartsWith(prefix, StringComparison.OrdinalIgnoreCase)
179179
&& (
180180
// Only match when there's a separator character either at the end of the
181181
// prefix or right after it.

src/Components/test/testassets/BasicTestApp/RouterTest/Links.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<li><NavLink href="/subdir/Default.html">With extension</NavLink></li>
1515
<li><NavLink href="/subdir/Other">Other</NavLink></li>
1616
<li><NavLink href="Other" Match=NavLinkMatch.All>Other with base-relative URL (matches all)</NavLink></li>
17-
<li><NavLink href="/subdir/Other?abc=123">Other with query</NavLink></li>
17+
<li><NavLink href="/subdir/other?abc=123">Other with query</NavLink></li>
1818
<li><NavLink href="/subdir/Other#blah">Other with hash</NavLink></li>
1919
<li><NavLink href="/subdir/WithParameters/Name/Abc">With parameters</NavLink></li>
2020
<li><NavLink href="/subdir/WithParameters/Name/Abc/LastName/McDef">With more parameters</NavLink></li>

0 commit comments

Comments
 (0)