From b3d58c57bd1bfe609d5ce481e1c4dfd5f993e75d Mon Sep 17 00:00:00 2001 From: Andy Sellick Date: Mon, 8 Jul 2024 15:06:27 +0100 Subject: [PATCH] Fix display of lists in RTL HTML publications - passes the `page_text_direction` into the govspeak html publication component to ensure that lists display properly in right to left content - govspeak html publication is used as a wrapper for the govspeak component, with some additional styles included - it still accepts and passes through to govspeak a `direction` parameter - in this case, pages had the the correct `direction` class applied to the top of the page, which seems to work for most of the styles on the page, but the govspeak CSS for RTL is written specifically assuming that the `direction` class is applied to the govspeak component (wrapping element) rather than any higher element, so the styles weren't being used properly - this resulted in a very subtle problem where lists had a margin applied to the wrong side (the default left side, for LTR content) instead of the right, which looks fine in most situations (because there's a gap between the right edge of the content and the left edge of the right hand column) unless the screen is shorter than the contents of the right hand column, forcing a scrollbar, which overlapped the bullets of the list - passing the govspeak html publication a `direction` option (that already existed, but wasn't being used for this purpose) fixes the problem, as the govspeak component now applies correct RTL styling to lists - consequence is that for LTR content this parameter is now explicitly passed, instead of previously assumed, but a quick visual/sense check suggests that this should be fine --- app/views/content_items/html_publication.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/content_items/html_publication.html.erb b/app/views/content_items/html_publication.html.erb index af2904560..4f804de9f 100644 --- a/app/views/content_items/html_publication.html.erb +++ b/app/views/content_items/html_publication.html.erb @@ -65,7 +65,7 @@
- <%= render "govuk_publishing_components/components/govspeak_html_publication", {} do %> + <%= render "govuk_publishing_components/components/govspeak_html_publication", { direction: page_text_direction } do %> <%= raw(@content_item.govspeak_body[:content]) %> <% end %>