Skip to content

Commit

Permalink
Add check for anchor links of the same page
Browse files Browse the repository at this point in the history
  • Loading branch information
SantosGuillamot committed Apr 17, 2024
1 parent d72cd02 commit 745e675
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/interactivity-router/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ const isValidLink = ( ref ) =>
ref.origin === window.location.origin &&
! ref.pathname.startsWith( '/wp-admin' ) &&
! ref.pathname.startsWith( '/wp-login.php' ) &&
! new URL( ref.href ).searchParams.get( '_wpnonce' );
! ref.getAttribute( 'href' ).startsWith( '#' ) &&
! new URL( ref.href ).searchParams.has( '_wpnonce' );

// Check if the event is valid for client-side navigation.
const isValidEvent = ( event ) =>
Expand Down

0 comments on commit 745e675

Please sign in to comment.