-
Notifications
You must be signed in to change notification settings - Fork 331
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
Investigate if changing the font loading mechanism is better for users #1437
Comments
This sounds like a good plan. We can create a few test pages and look at the impact on perceived performance using WPT or sitespeed.io. We should also test this under both HTTP/1.1 and HTTP/2 since h2 is planned for the future (and dependent services will be a mixture of both). |
We need to have a better understanding and test what it means for the font-display to use `swap` instead of fallback. A new issue has been created: #1437
We need to have a better understanding and test what it means for the font-display to use `swap` instead of fallback. A new issue has been created: #1437
We need to have a better understanding and test what it means for the font-display to use `swap` instead of fallback. A new issue has been created: #1437
We need to have a better understanding and test what it means for the font-display to use `swap` instead of fallback. A new issue has been created: #1437
NoteThis comment overrides any comments / considerations made in PR 1607. The testing method I used in that PR was flawed so the end results weren't accurate. The method used was to run a very small number of test runs (usually 9), then base results of the median result. The limited number of runs doesn't give an accurate representation of real-world performance, and can easily introduce large variations. The updated testing method relies on us using our own WebPageTest instance which gives us the ability to run a lot more tests than the public instance (201 vs 9). This should give us a much more accurate representation. HypothesisChanging Reasons for HypothesisAccording to the specification:
Now although these two settings look very similar in terms of the specification, practical implementation by browsers is different:
Others have suggested changing
More discussion about this can be seen here, here and here. TestingI will be running 201 test runs over each of 4 GOV.UK pages on production:
The tests will be conducted at 3 connection speeds on Chrome:
This should give a fairly representative idea of user experience, since we have a high percentage of users on a 3G or greater effective connection type. ResultsHomepage - CableTest link (GDS internal only access) Observations
Winner: Homepage - 3GTest link (GDS internal only access)
Winner: Homepage - 3G SlowTest link (GDS internal only access)
Winner: Guidance page - CableTest link (GDS internal only access)
Winner: Guidance page - 3GTest link (GDS internal only access)
Winner: Guidance page - 3G SlowTest link (GDS internal only access)
Winner: Start page - CableTest link (GDS internal only access)
Winner: Start page - 3GTest link (GDS internal only access)
Winner: Start page - 3G SlowTest link (GDS internal only access)
Winner: Speech page - CableTest link (GDS internal only access)
Winner: Speech page - 3GTest link (GDS internal only access)
Winner: Speech page - 3G SlowTest link (GDS internal only access)
Winner: SummaryThe table below gives a summary of the results above. Which
Chrome performed as per the spec:
Recommendation: change the This shouldn't hugely effect other areas since users will already be seeing the fallback font before the web font has loaded, only after 100ms rather than immediately. This also gives slow connections the chance to render the web font. Since they are already downloading it, they may as well see it at some point. If the last point is a point of contention then we should consider using In regards to HTTP/1.1 vs HTTP/2, this shouldn't really come into the decision. The use of HTTP/2 will make it more likely that the web font is delivered in a decent time, but it won't change the upfront rendering as controlled by |
Just to note this is an excellent investigation thanks for putting together this Matt.
Are we sure that if a user has been reading content for 6+ seconds and then the font changes that this is a good user experience? You could argue that the current experience where the font doesnt load if it's very slow is the least disruptive. The font will still benefit from being downloaded for future pages the user goes to. |
That's a good point, but I actually struggled to see the difference between 'nta' and 'Arial' in the tests at times. I had to focus of particular glyphs (usually 'l') to identify when the web font had loaded. So I'd hope it isn't hugely jarring between the font swap. And with version 2 of the font, now that the em-box settings now match Arial, it should be much smoother than we saw in version 1. I guess the question is: would we prefer the majority of users to see the content instantly on paint with no invisible text and visible repaint to the fallback font (which is quite disruptive), as we have now OR prefer the From this data, we have 0% on 2G or 2G Slow according to Effective Connection Type (ECT). I fail to believe that we have nobody in the UK on a ECT of 2G and below, but this is the only data we have to back up the decision at the moment. Personally I'd prefer users not to see the invisible text and repaint at the start of the page load, as I feel it would be more noticeable and disruptive. |
I think I would trade having a stable page that doesnt risk reflowing and moving text as our users are reading it over a very short 100ms window of time during the loading of the page which users will be used to things incrementally loading in as they browse across the web. When it comes to perception of speed the main priority is that users see something happening, which is the same for both If people think that the risk of the text reflowing or disrupting people reading is negligible then I'm not going to block this as I agree removing the 100ms gap would be nice, however when we tested the fonts I seem to remember fallback fonts not being perfectly aligned with GDS Transport which meant that content could shift and reflow. That is something that would be annoying if you're mid way through reading a page to have it shift and lose your place. |
If it is that we aren't too concerned about the first 100ms for text content, then maybe we should be considering This has is the same setup as |
Is it true that |
According to the spec:
And the example given sounds like something we are aiming for:
We can certainly test the results on simulated Cable / 4G / 3G connections to identify what happens. |
I've just investigated the impact of Cable connection
4G connection
3G connection
So out of the 1200 test runs the web font wasn't rendered on initial page load. Of the 1200 repeat view tests, the web font was displayed every time. So So here's where we stand for all
At the moment it is difficult to decide which setting is best for users without more information about their connection speeds. Decision: ?? |
@Nooshu do you know if Chrome's recent work to avoid pages jumping when images load could prevent the issues I'm worried about? |
We could revisit (This was previously implemented in alphagov/govuk_frontend_toolkit#271 but had to be reverted due to the way we implemented tabular numbers – see alphagov/govuk_frontend_toolkit#300) |
Definitely worth a think about regardless of this pull request, since even with fallback there's a smaller window of time where the font can replace a fallback. That feature seems to have minimal support in firefox: https://caniuse.com/#search=font-display when compared with the font-display feature: https://caniuse.com/#search=font-size-adjust |
I've just had an article published in this years Web Performance Calendar all about this issue. Data shows we could have users on incredibly slow connections in the UK, for which the font loading could take large amount of time. The shift between fallback & webfont is quite significant (especially for v1) and a setting of To quote from the article:
So I'd say we stick with |
We currently use
font-display: fallback
to load our fonts:Matt's new font work he has suggested that we change
fallback
toswap
, which is also recommended by performance community members, however when testing in our development environment we have noticed that when the page is switching fonts text "jumps" more than before.We should determine what the difference is to users in the following scenarios, in order of priority:
Reference: https://font-display.glitch.me/
The text was updated successfully, but these errors were encountered: