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

Font loading strategy #8522

Open
1 task
jroebu14 opened this issue Dec 3, 2020 · 2 comments
Open
1 task

Font loading strategy #8522

jroebu14 opened this issue Dec 3, 2020 · 2 comments
Labels
cross-team For visibility for both World Service teams (Engage & Media) investigation performance Refinement Needed This is ready for refinement. It shouldn't be worked on until it has been refined by Dev & Test. technical-work Technical debt, support work and building new technical tools and features

Comments

@jroebu14
Copy link
Contributor

jroebu14 commented Dec 3, 2020

Is your feature request related to a problem? Please describe.
Related to the findings mentioned in this issue https://github.com/bbc/simorgh-infrastructure/issues/1312

Our fonts are loaded synchronously (blocking) and are prioritised above JS bundles because CSS with font paths are inlined in the html near the top of the document before most other assets.

Describe the solution you'd like
We should find a way to async load our fonts so that other assets such as JS bundles are prioritised above the font requests.

The async font loading solution should also work with JS disabled.

This is an investigation/spike issue to find a solution that fits best in the Simorgh application and works best for our users.

A separate issue to outline the approach should be written after the completion of this spike.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Testing notes
[Tester to complete]

Dev insight: Will Cypress tests be required or are unit tests sufficient? Will there be any potential regression? etc

  • This feature is expected to need manual testing.

Additional context
Add any other context or screenshots about the feature request here.

@jroebu14 jroebu14 added Refinement Needed This is ready for refinement. It shouldn't be worked on until it has been refined by Dev & Test. investigation cross-team For visibility for both World Service teams (Engage & Media) labels Dec 3, 2020
@joshcoventry joshcoventry added this to the Frontend Web Performance milestone Dec 3, 2020
@neildoughty
Copy link

I suspect i'm misunderstanding this, but i always presumed we were using font-family to help with this:
https://developers.google.com/web/updates/2016/02/font-display

We planned to use OPTIONAL for fonts which are there solely for aesthetic reasons (eg Reith for Mundo), and SWAP when we consider the font essential to the reading experience (eg Mallana for Telugu).

@jroebu14
Copy link
Contributor Author

jroebu14 commented Dec 4, 2020

@neildoughty you are correct - we are using font-display. Apologies, I'm playing catch-up on how we handle font loading. I'll change the above description of the issue because after doing some reading I'm not convinced that asynchronously loading fonts is a good idea based on this https://web.dev/optimize-webfont-loading/

My current thinking is that we need to have a separate stylesheet for fonts that we preload to solve the problem of fonts being prioritised ahead of our javascript bundles. We think this problem exists because the font declarations are inlined in the HTML at the top of the document and the browsers sees the font files before JS bundles and dispatches requests for the fonts. I'm not 100% certain that this will solve the problem though. I can try this out locally and report back.

@jroebu14 jroebu14 changed the title Async load fonts Font loading strategy Jan 13, 2021
@andrewscfc andrewscfc added the technical-work Technical debt, support work and building new technical tools and features label Apr 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cross-team For visibility for both World Service teams (Engage & Media) investigation performance Refinement Needed This is ready for refinement. It shouldn't be worked on until it has been refined by Dev & Test. technical-work Technical debt, support work and building new technical tools and features
Projects
None yet
Development

No branches or pull requests

4 participants