-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed
Labels
[Status] In ProgressTracking issues with work in progressTracking issues with work in progress[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended
Description
Description
Since the introduction of session-based history tagging in PR #75927, native anchor/hash links (e.g., <a href="#section">) cause the entire page to reload. Specifically, the issue seems to be with this portion of the PR:
window.addEventListener( 'popstate', ( event ) => {
if ( event.state?.wpInteractivityId !== sessionId ) {
window.location.reload();
}
} );
When a user clicks a standard hash link, the browser creates a new history entry. Because this new state does not contain the wpInteractivityId assigned at the start of the session, the popstate listener in @wordpress/interactivity identifies it as a stale session and executes window.location.reload().
Step-by-step reproduction instructions
- Use a WordPress site with Gutenberg 22.7.0 enabled
- Create a page with long content and a standard HTML anchor link:
<a href="#footer">Go to Footer</a>. - Ensure the page also has some block that requires interactivity (Ex: a core/navigation block)
- Click the Go to Footer link.
- Observed behavior: The page reloads entirely instead of simply scrolling to the ID.
- Expected behavior: The browser should navigate to the fragment identifier without a page refresh.
Screenshots, screen recording, code snippet
No response
Environment info
- Gutenberg 22.7.0
- Wordpress 6.9.4
- Exists on Chrome and Brave
- Exists on Android and Windows
Please confirm that you have searched existing issues in the repo.
- Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
- Yes
Please confirm which theme type you used for testing.
- Block
- Classic
- Hybrid (e.g. classic with theme.json)
- Not sure
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
[Status] In ProgressTracking issues with work in progressTracking issues with work in progress[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended
Type
Fields
Give feedbackNo fields configured for issues without a type.