Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix display of lists in RTL HTML publications #3257

Merged
merged 1 commit into from
Jul 9, 2024
Merged

Conversation

andysellick
Copy link
Contributor

⚠️ This repo is Continuously Deployed: make sure you follow the guidance ⚠️

What / why

  • 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

Example HTML publication pages:

Visual changes

First, here's the problem.

Seems fine But my screen is shorter forcing a scrollbar on the right column
Screenshot 2024-07-08 at 15 13 30 Screenshot 2024-07-08 at 15 13 37

Now, with the .direction-rtl class applied to the govspeak component, it looks like this:

Before After
Screenshot 2024-07-08 at 15 18 54 Screenshot 2024-07-08 at 15 19 00

Trello card: https://trello.com/c/HXiajSKv/183-bullet-points-cut-off-in-html-attachments-in-rtl-languages

- 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
@govuk-ci govuk-ci temporarily deployed to government-frontend-pr-3257 July 8, 2024 14:23 Inactive
Copy link
Contributor

@AshGDS AshGDS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks for the detailed PR description 👍 🎉

@andysellick andysellick merged commit a5ce36c into main Jul 9, 2024
12 checks passed
@andysellick andysellick deleted the fix-rtl-lists branch July 9, 2024 07:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants