Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

fix: Incorrect Current Page link state on dynamic pages (#4266)

Ivan Starkov619b0c1b9a41
diff --git a/packages/sdk-components-react-remix/src/shared/remix-link.tsx b/packages/sdk-components-react-remix/src/shared/remix-link.tsx
index 48c8310fc6..399ea1038a 100644
--- a/packages/sdk-components-react-remix/src/shared/remix-link.tsx
+++ b/packages/sdk-components-react-remix/src/shared/remix-link.tsx
@@ -33,7 +33,9 @@ export const wrapLinkComponent = (BaseLink: typeof Link) => {
// always render simple <a> in canvas and preview
// since remix links do not affect it
if (renderer !== "canvas" && renderer !== "preview") {
- return <RemixLink {...props} to={href} ref={ref} />;
+ // In the future, we will switch to the :local-link pseudo-class (https://developer.mozilla.org/en-US/docs/Web/CSS/:local-link). (aria-current="page" is used now)
+ // Therefore, we decided to use end={true} (exact route matching) for all links to facilitate easier migration.
+ return <RemixLink {...props} to={href} ref={ref} end />;
}
}