From 7d3148c7fa4c4f3315f56e01cb1bc25b7c1d3198 Mon Sep 17 00:00:00 2001 From: Lance Keay Date: Fri, 17 Jul 2026 16:01:39 +0100 Subject: [PATCH 1/2] Back-to-top: scope back to CMS wiki/content pages only (ticket 292881) Reverts f0812507 which had moved the partial into _Layout, _AdminLayout, and _ShareLayout so every page rendered a back-to-top link. Users report the pill gets in the way on non-guidance surfaces (search results, admin lists, dashboards, share pages), so return to the original ticket 290817 scope: partial renders only from Wiki.cshtml and Content.cshtml (the CMS node views), and the enhancement script stays in _Layout with defer. Public and admin surfaces outside the CMS no longer render the pill. The script no-ops on any page without an .app-back-to-top container, so short-form CMS pages that don't scroll past the fold still see nothing. --- .../Views/Page/Content.cshtml | 2 +- .../Views/Page/Wiki.cshtml | 6 +++++- .../Views/Shared/_AdminLayout.cshtml | 11 ----------- .../Views/Shared/_Layout.cshtml | 6 ------ .../Views/Shared/_ShareLayout.cshtml | 13 ------------- 5 files changed, 6 insertions(+), 32 deletions(-) diff --git a/src/DfE.CheckPerformanceData.Web/Views/Page/Content.cshtml b/src/DfE.CheckPerformanceData.Web/Views/Page/Content.cshtml index dc61777a..a003b671 100644 --- a/src/DfE.CheckPerformanceData.Web/Views/Page/Content.cshtml +++ b/src/DfE.CheckPerformanceData.Web/Views/Page/Content.cshtml @@ -82,7 +82,7 @@ } @await Html.PartialAsync("ContentPages/_ContentNodes", content) -@* Back-to-top now lives in _Layout.cshtml so every page gets it universally. *@ +@await Html.PartialAsync("ContentPages/_BackToTop") @* Equalise the height of dfe-cards that live as direct grandchildren of a govuk-grid-row. Flex-wrap keeps cards in the same VISUAL row equal, but cards that wrap to a new row are diff --git a/src/DfE.CheckPerformanceData.Web/Views/Page/Wiki.cshtml b/src/DfE.CheckPerformanceData.Web/Views/Page/Wiki.cshtml index e7e41fcd..c17f9f2e 100644 --- a/src/DfE.CheckPerformanceData.Web/Views/Page/Wiki.cshtml +++ b/src/DfE.CheckPerformanceData.Web/Views/Page/Wiki.cshtml @@ -29,4 +29,8 @@ -@* Back-to-top now lives in _Layout.cshtml so every page gets it universally. *@ +@* Placed OUTSIDE the govuk-grid-row so its natural position is below all page content — + position:sticky needs the natural position to sit below the viewport for the pin to + engage. Rendering it here (rather than inside the one-third column) makes the wiki + layout behave identically to the full-width Content.cshtml pages. *@ +@await Html.PartialAsync("ContentPages/_BackToTop") diff --git a/src/DfE.CheckPerformanceData.Web/Views/Shared/_AdminLayout.cshtml b/src/DfE.CheckPerformanceData.Web/Views/Shared/_AdminLayout.cshtml index 4546bb55..2c181eff 100644 --- a/src/DfE.CheckPerformanceData.Web/Views/Shared/_AdminLayout.cshtml +++ b/src/DfE.CheckPerformanceData.Web/Views/Shared/_AdminLayout.cshtml @@ -192,10 +192,6 @@
@RenderBody() - @* Universal back-to-top link — rendered inside
so its natural - position is below all page content in the admin column. Sticky until - the reader scrolls past the fold, then releases above the footer. *@ - @await Html.PartialAsync("ContentPages/_BackToTop")
} @@ -213,8 +209,6 @@ else
@RenderBody() - @* Universal back-to-top link — see comment on the wide variant above. *@ - @await Html.PartialAsync("ContentPages/_BackToTop")
@@ -254,10 +248,5 @@ else responds to clicks — the shared _Layout also loads it, but admin views run under this layout instead. *@ - @* Back-to-top reveal-on-scroll enhancement — loaded here for the same reason - as the shared _Layout: admin views don't inherit from _Layout, so the script - needs its own registration on the admin bundle. defer keeps the fetch off - the critical path. *@ - @RenderSection("Scripts", required: false) } diff --git a/src/DfE.CheckPerformanceData.Web/Views/Shared/_Layout.cshtml b/src/DfE.CheckPerformanceData.Web/Views/Shared/_Layout.cshtml index 6d5fb1e6..ba5c9c09 100644 --- a/src/DfE.CheckPerformanceData.Web/Views/Shared/_Layout.cshtml +++ b/src/DfE.CheckPerformanceData.Web/Views/Shared/_Layout.cshtml @@ -145,12 +145,6 @@ @Html.GovUkFrontendJsEnabledScript() @await Html.PartialAsync("_ContactUsBanner") @RenderBody() -@* Universal back-to-top link. Rendered here (rather than per-view) so every long - page — search results, dashboards, admin lists, CMS content — gets it without - having to remember to include the partial. The script is hidden-until-scroll - so short pages never show it, and the container collapses to zero height while - hidden so no phantom footer gap. *@ -@await Html.PartialAsync("ContentPages/_BackToTop") @Html.GovUkFrontendScriptImports() @section Footer { diff --git a/src/DfE.CheckPerformanceData.Web/Views/Shared/_ShareLayout.cshtml b/src/DfE.CheckPerformanceData.Web/Views/Shared/_ShareLayout.cshtml index d2d27e23..72fe2a15 100644 --- a/src/DfE.CheckPerformanceData.Web/Views/Shared/_ShareLayout.cshtml +++ b/src/DfE.CheckPerformanceData.Web/Views/Shared/_ShareLayout.cshtml @@ -29,23 +29,10 @@
@RenderBody() - @* Universal back-to-top link — long share pages (aggregate dashboards, replays) - benefit from a jump-to-top; the partial is hidden-until-scroll so short pages - see nothing. No dependency on the admin nav / GTM the rest of this layout - deliberately omits — just an anchor + a small enhancement script. *@ - @await Html.PartialAsync("ContentPages/_BackToTop")
@Html.GovUkFrontendScriptImports() -@section BodyEnd { - @* Back-to-top reveal-on-scroll enhancement. Share layout otherwise runs script- - light (no cookies.js, no admin bundles) — this one enhancement script is - small and defers off the critical path so the tokened share page renders - fast even on constrained networks. *@ - -} - @section Footer {