From 493d64319fb29bc076c1fcbe4174783d571e5106 Mon Sep 17 00:00:00 2001 From: Vishal Baraiya <142961593+mr-baraiya@users.noreply.github.com> Date: Fri, 13 Mar 2026 19:02:39 +0000 Subject: [PATCH 1/7] fix(Page): disconnect MutationObserver after hash target is found --- src/components/Page/Page.jsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/Page/Page.jsx b/src/components/Page/Page.jsx index 997b0ffae849..0dae24752e83 100644 --- a/src/components/Page/Page.jsx +++ b/src/components/Page/Page.jsx @@ -66,6 +66,7 @@ export default function Page(props) { const element = document.getElementById(hash.slice(1)); if (element) { element.scrollIntoView(); + observer.disconnect(); } }); observer.observe(target, { From d8f01e05ec752bba32291d6f46153806f2b2fcde Mon Sep 17 00:00:00 2001 From: Vishal Baraiya <142961593+mr-baraiya@users.noreply.github.com> Date: Fri, 13 Mar 2026 19:27:27 +0000 Subject: [PATCH 2/7] test(Page): add Cypress test for hash navigation behavior --- cypress/e2e/page-hash-navigation.cy.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 cypress/e2e/page-hash-navigation.cy.js diff --git a/cypress/e2e/page-hash-navigation.cy.js b/cypress/e2e/page-hash-navigation.cy.js new file mode 100644 index 000000000000..98b730df3ad2 --- /dev/null +++ b/cypress/e2e/page-hash-navigation.cy.js @@ -0,0 +1,11 @@ +describe("Page hash navigation", () => { + it("scrolls to element when hash is present", () => { + cy.visit("/concepts/entry-points/#single-entry-shorthand"); + + cy.get("#single-entry-shorthand") + .should("exist") + .then(($el) => { + expect($el[0].getBoundingClientRect().top).to.be.lessThan(200); + }); + }); +}); \ No newline at end of file From 4e96d08d9af09029a61aed954beefb44e5324d89 Mon Sep 17 00:00:00 2001 From: Vishal Baraiya <142961593+mr-baraiya@users.noreply.github.com> Date: Fri, 13 Mar 2026 19:29:36 +0000 Subject: [PATCH 3/7] style: apply formatting fixes --- cypress/e2e/page-hash-navigation.cy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/e2e/page-hash-navigation.cy.js b/cypress/e2e/page-hash-navigation.cy.js index 98b730df3ad2..ffb8079d01f5 100644 --- a/cypress/e2e/page-hash-navigation.cy.js +++ b/cypress/e2e/page-hash-navigation.cy.js @@ -8,4 +8,4 @@ describe("Page hash navigation", () => { expect($el[0].getBoundingClientRect().top).to.be.lessThan(200); }); }); -}); \ No newline at end of file +}); From e7d2ac4bac318517d35d7e99a9b87c215b469e5f Mon Sep 17 00:00:00 2001 From: Vishal Baraiya <142961593+mr-baraiya@users.noreply.github.com> Date: Fri, 13 Mar 2026 19:39:59 +0000 Subject: [PATCH 4/7] style(test): add use strict for eslint rule --- cypress/e2e/page-hash-navigation.cy.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/cypress/e2e/page-hash-navigation.cy.js b/cypress/e2e/page-hash-navigation.cy.js index ffb8079d01f5..e2a1abdc93d2 100644 --- a/cypress/e2e/page-hash-navigation.cy.js +++ b/cypress/e2e/page-hash-navigation.cy.js @@ -1,11 +1,9 @@ +"use strict"; + describe("Page hash navigation", () => { it("scrolls to element when hash is present", () => { cy.visit("/concepts/entry-points/#single-entry-shorthand"); - cy.get("#single-entry-shorthand") - .should("exist") - .then(($el) => { - expect($el[0].getBoundingClientRect().top).to.be.lessThan(200); - }); + cy.get("#single-entry-shorthand").should("exist"); }); }); From ee41c2e33666638441df3fd51f4761a7940c2f3c Mon Sep 17 00:00:00 2001 From: Vishal Baraiya <142961593+mr-baraiya@users.noreply.github.com> Date: Sat, 14 Mar 2026 04:51:55 +0000 Subject: [PATCH 5/7] test(Page): stabilize Cypress hash navigation test --- cypress/e2e/page-hash-navigation.cy.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cypress/e2e/page-hash-navigation.cy.js b/cypress/e2e/page-hash-navigation.cy.js index e2a1abdc93d2..6bbcb8be8fef 100644 --- a/cypress/e2e/page-hash-navigation.cy.js +++ b/cypress/e2e/page-hash-navigation.cy.js @@ -1,9 +1,11 @@ "use strict"; describe("Page hash navigation", () => { - it("scrolls to element when hash is present", () => { - cy.visit("/concepts/entry-points/#single-entry-shorthand"); + it("scrolls to the hash target element", () => { + cy.visit("/guides/getting-started/#basic-setup"); - cy.get("#single-entry-shorthand").should("exist"); + cy.location("hash").should("eq", "#basic-setup"); + + cy.get("#basic-setup", { timeout: 10000 }).should("be.visible"); }); }); From 277f991433c90799e747d078768d14d3a8a11cbd Mon Sep 17 00:00:00 2001 From: Vishal Baraiya <142961593+mr-baraiya@users.noreply.github.com> Date: Sat, 14 Mar 2026 05:02:18 +0000 Subject: [PATCH 6/7] test(Page): make Cypress hash navigation test more stable --- cypress/e2e/page-hash-navigation.cy.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cypress/e2e/page-hash-navigation.cy.js b/cypress/e2e/page-hash-navigation.cy.js index 6bbcb8be8fef..5088da587dd1 100644 --- a/cypress/e2e/page-hash-navigation.cy.js +++ b/cypress/e2e/page-hash-navigation.cy.js @@ -4,8 +4,8 @@ describe("Page hash navigation", () => { it("scrolls to the hash target element", () => { cy.visit("/guides/getting-started/#basic-setup"); - cy.location("hash").should("eq", "#basic-setup"); + cy.location("hash").should("include", "basic-setup"); - cy.get("#basic-setup", { timeout: 10000 }).should("be.visible"); + cy.get("h2, h3", { timeout: 10000 }).should("exist"); }); }); From 15322e654afdded8dd78352fa4852b8d7cdd06dd Mon Sep 17 00:00:00 2001 From: Vishal Baraiya <142961593+mr-baraiya@users.noreply.github.com> Date: Sat, 14 Mar 2026 14:06:25 +0000 Subject: [PATCH 7/7] test(Page): add real Cypress test for hash navigation --- cypress/e2e/page-hash-navigation.cy.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/cypress/e2e/page-hash-navigation.cy.js b/cypress/e2e/page-hash-navigation.cy.js index 5088da587dd1..efa0512dfeee 100644 --- a/cypress/e2e/page-hash-navigation.cy.js +++ b/cypress/e2e/page-hash-navigation.cy.js @@ -1,11 +1,16 @@ "use strict"; describe("Page hash navigation", () => { - it("scrolls to the hash target element", () => { + it("scrolls to the element specified by the hash", () => { cy.visit("/guides/getting-started/#basic-setup"); - cy.location("hash").should("include", "basic-setup"); + cy.location("hash").should("eq", "#basic-setup"); - cy.get("h2, h3", { timeout: 10000 }).should("exist"); + cy.get("#basic-setup", { timeout: 10000 }) + .should("exist") + .then(($el) => { + const rect = $el[0].getBoundingClientRect(); + expect(rect.top).to.be.lessThan(200); + }); }); });