-
Notifications
You must be signed in to change notification settings - Fork 1
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
EL-986 make pdf titles single blocks #795
Conversation
ab37ef4
to
6653ff3
Compare
@willc-work have you verified that this fixes the accessibility issue? It looked from the ticket like the splits being reported in the accessibility audit didn't necessarily line up with visible line breaks, so I wasn't sure if fixing the line breaks would fix the a11y problem. |
@patrick-laa the ticket indicates that the issue is that the title is split into 3 sections, each of which are given a H1, so there is a single heading but the screenreader splits it into 3 and announces each one e.g |
5b693ca
to
ea85a2f
Compare
@willc-work the screenshot suggests that the split is "Check if your client quali" "fi" "es for legal aid". If this split was due to line breaks I'd be surprised, simply because I don't think any linebreak algorithm would break "qualifies" into 3 like that. So I'm not sure that line breaks are the source of the problem. |
@MazOneTwoOne do you now have working Adobe? If so, can you download a PDF from https://el-986-pdf-a11y-check-client-qualifies-legal-aid-uat.cloud-platform.service.justice.gov.uk/ and confirm that the reported bizarre "fi" split etc is fixed? |
@patrick-laa if I only have the line: |
Hey Both, Still don't have Adobe Pro (for accessibility checks/tree) or NVDA (Windows screen reader) to verify this. What I did notice, is that these changes have also fixed iOS screen readers, being able to announce numbers but added in another issue with iOS screen readers.
|
@patrick-laa ok I have signed up for a 14 day free trial at https://assistivlabs.com/ and done some more testing. Even though I am able to get the title into a single span locally, when I try it on UAT it splits it again into 3 sections it also does this on the second heading mentioned on the ticket. As noted the split is really weird, but in both sections Confirmed that it is this combination or characters that is causing the strange behaviour, I think this is a puppeteer (as opposed to grover) issue. |
55a270d
to
ea85a2f
Compare
@willc-work looks like someone else experienced 'fi' weirdness - puppeteer/puppeteer#4125 (comment), and suggested Although that would only explain the h1 issue, not the h2 issue (and no idea why the h2, which also has a "fi", doesn't also have a split there) |
ecebea9
to
c6ac04f
Compare
ed11623
to
f2d26a7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK cool, so if this solves the fi
split mentioned in 1.3.1 of the report that's great. Do we think that the h2 issue they mentioned 1.4.1, which is a split without a 'fi', is completely separate?
Also, they say in the 1.3.1 bit that it would be better if there was only one h1 element. With this fix we've got it down from 4 to 2. But there actually are 2 h1 elements on the page - both "Check if your client qualifies...." and "Your client is likely to qualify for...". Would it be a good idea, as a bonus thing, to fix it so that the first one is an h1 and the second is an h2?
The h2 issue is the same issue isn't it? The report says it is split in 3 parts but I am actually seeing it split into 4 parts, with the 2 instances of re: the the multiple h1's I will go back and have a look at that. |
@willc-work I'm not sure it is the same issue. What we see on their report (not on our own replication in adobe) is that with the h1, the "fi" bit is split into its own line: |
4d5a054
to
2af8f5b
Compare
@willc-work the problem with a |
db9087e
to
ba09d31
Compare
@patrick-laa the issue with the no-wrap appears to be browser specific. I have added in a scale: attribute to grover_options so that the page is scaled in browsers that dont automatically do this so that all of the wording fits on the line and is printed as exopected |
app/services/pdf_service.rb
Outdated
@@ -10,6 +10,7 @@ class PdfService | |||
emulate_media: "screen", | |||
launch_args: ["--font-render-hinting=medium", "--no-sandbox"], | |||
execute_script: "document.querySelectorAll('button').forEach(el => el.style.display = 'none')", | |||
scale: 0.75 / 1.0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't fix the issue with trying to print the page on Chrome that I screenshotted before (because printing doesn't involve PdfService at all).
I've got another theory. The line breaks were occurring because when grover/puppeteer "looks at" the page, it's using a small viewport, narrow enough that the h2 line was being broken up. But it didn't actually insert visible linebreaks at those points, they only appeared in the underlying structure exposed by the accessibility tool. So we can infer that: the size of the viewport affects accessibility data without affecting the look of the page.
So how about you try removing the "no-wrap" CSS (to fix the print view in Chrome), but then setting the grover viewport to be super wide (the default is only 640px - https://github.com/Studiosity/grover#configuration) so that when it's viewing the page the header doesn't have a linebreak in it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New issue identified with print screen.
683b022
to
6afe33e
Compare
@patrick-laa apologies, you are correct, for some reason i cant use the print from page button on firefox or chrome either locally or on UAT. |
app/services/pdf_service.rb
Outdated
@@ -7,6 +7,10 @@ class PdfService | |||
left: "1cm", | |||
right: "1cm", | |||
}, | |||
viewport: { | |||
width: 800, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Has this had any effect, or am I barking up the wrong tree? If it works the way I hoped it works, changing the width from 640 to 800 wouldn't get rid of all breakpoints in the accessibility metadata, but we'd maybe see them shift along a bit (without affecting how the PDF actually looked). Then it would just be a case of finding a width that was enough to remove them entirely.
b98bba6
to
32523d2
Compare
7ed9bb8
to
f56c85f
Compare
dont use partial for service name add scale for chrome print to PDF
f56c85f
to
beff761
Compare
Jira ticket
as covered in the comments, the problem is related to ligatures (@exonian I believe you called this as a potential problem early on, bit I evidently missed that). The css fix to the print page prevents the split on
fi
character pairsremoved the partial being used to display the service name as a H1 and added a H2 directly to the print page.
as per:
https://usability.yale.edu/web-accessibility/articles/headings
https://www.w3.org/WAI/tutorials/page-structure/headings/#main-heading-after-navigation
there is no problem with a H2 appearing before a H1 and the H1 should be the most important part, which for us is the result.
The issue with the H2 being split (1.4.1) cannot be exactly replicated. The fix for 1.3.1 also prevents splits on this H2 but the PDF splits anything that crosses more than 1 line. For spans this isn't really an issue but for headings this will result in each line being announced as a heading. The fix for this in this case is to prevent wrapping. It doesnt cause any issues with the rest of the display, although the heading looks slightly smaller on the page.
Guidance to review
Checklist
Before you ask people to review this PR: