diff --git a/app/assets/stylesheets/views/_html-publication.scss b/app/assets/stylesheets/views/_html-publication.scss
index e7390bcbb..9d852a37c 100644
--- a/app/assets/stylesheets/views/_html-publication.scss
+++ b/app/assets/stylesheets/views/_html-publication.scss
@@ -22,6 +22,14 @@
}
.contents-list-container {
+ @include govuk-media-query($from: desktop) {
+ position: sticky;
+ top: govuk-spacing(2);
+ max-height: 100vh;
+ overflow-y: auto;
+ margin-bottom: govuk-spacing(4);
+ }
+
.direction-rtl & {
float: right;
}
diff --git a/app/views/content_items/html_publication.html.erb b/app/views/content_items/html_publication.html.erb
index 496e0f2a9..622d08698 100644
--- a/app/views/content_items/html_publication.html.erb
+++ b/app/views/content_items/html_publication.html.erb
@@ -49,40 +49,32 @@
type: @content_item.schema_name
} %>
-
- <% if @content_item.contents.any? %>
-
- <%= render 'govuk_publishing_components/components/contents_list', contents: @content_item.contents, format_numbers: true %>
- <%= render "govuk_publishing_components/components/print_link", {
- margin_top: 0,
- margin_bottom: 6,
- } %>
-
- <% end %>
+
+
+ <% if @content_item.contents.any? %>
+
+ <%= render 'govuk_publishing_components/components/contents_list', contents: @content_item.contents, format_numbers: true %>
+ <%= render "govuk_publishing_components/components/print_link", {
+ margin_top: 0,
+ margin_bottom: 6,
+ } %>
+
+ <% end %>
-
-
-
- <%= render "govuk_publishing_components/components/govspeak_html_publication", {} do %>
- <%= raw(@content_item.govspeak_body[:content]) %>
- <% end %>
+
+ <%= render "govuk_publishing_components/components/govspeak_html_publication", {} do %>
+ <%= raw(@content_item.govspeak_body[:content]) %>
+ <% end %>
+
-
- <%= render 'components/back-to-top', href: "#contents" %>
-
- <%= render "govuk_publishing_components/components/print_link", {
- margin_top: 0,
- margin_bottom: 6,
- } %>
-
+
+ <%= render 'components/back-to-top', href: "#contents", text: "Back to top" %>
diff --git a/test/integration/html_publication_test.rb b/test/integration/html_publication_test.rb
index 879e9c00e..df4f7a4b9 100644
--- a/test/integration/html_publication_test.rb
+++ b/test/integration/html_publication_test.rb
@@ -26,7 +26,7 @@ class HtmlPublicationTest < ActionDispatch::IntegrationTest
test "html publications with meta data" do
setup_and_visit_html_publication("print_with_meta_data")
- within ".govuk-grid-row.sidebar-with-body" do
+ within ".sidebar-with-body" do
assert page.find(".print-meta-data", visible: false)
assert page.has_no_text?("© Crown copyright #{@content_item['details']['public_timestamp'].to_date.year}")
@@ -37,7 +37,7 @@ class HtmlPublicationTest < ActionDispatch::IntegrationTest
test "html publications with meta data - print version" do
setup_and_visit_html_publication("print_with_meta_data", "?medium=print")
- within ".govuk-grid-row.sidebar-with-body" do
+ within ".sidebar-with-body" do
assert page.find(".print-meta-data", visible: true)
assert page.has_text?("© Crown copyright #{@content_item['details']['public_timestamp'].to_date.year}")