From 619b0c1b9a414ac218c754bc9af344c44bbeee09 Mon Sep 17 00:00:00 2001 From: Ivan Starkov Date: Fri, 11 Oct 2024 14:19:01 +0300 Subject: [PATCH] fix: Incorrect Current Page link state on dynamic pages (#4266) ## Description closes #3560 ## Steps for reproduction 1. click button 2. expect xyz ## Code Review - [ ] hi @kof, I need you to do - conceptual review (architecture, feature-correctness) - detailed review (read every line) - test it on preview ## Before requesting a review - [ ] made a self-review - [ ] added inline comments where things may be not obvious (the "why", not "what") ## Before merging - [ ] tested locally and on preview environment (preview dev login: 5de6) - [ ] updated [test cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md) document - [ ] added tests - [ ] if any new env variables are added, added them to `.env` file --- packages/sdk-components-react-remix/src/shared/remix-link.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 48c8310fc6b..399ea1038a6 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 in canvas and preview // since remix links do not affect it if (renderer !== "canvas" && renderer !== "preview") { - return ; + // 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 ; } }