Optimising perceived performance by avoiding issues like FOIT, FOUT
FOUT stands for “Flash of Unstyled Text”. FOUT is what happens if web page designers decide to display the page in full before font files arrive. FOUT is actually a special case of FOUC – Flash of Unstyled Content – in which the browser renders the entire web page briefly with default browser styles because the markup has loaded but the CSS sheet that dictates layout of the page has not. After a short time (often less than a second) when the CSS sheet does load the whole page re-flows to take on the layout defined by the CSS. This can be very disorienting to the user and at times give the impression of a broken website.
FOIT stands for “Flash of Invisible Text”. FOIT is the phenomenon users get when the page designer chooses to render the layout of the page but wait to place visible text until the custom fonts have loaded. From an information consumption standpoint, this leaves the page unusable for a short time
Hence we need to make use of mitigating techniques to make the application have the appearance of a high level of performance.We can opt for both CSS based or JS based solutions for this depending on our requirement like:
1. Reduce file sizes
2. Use the CSS "font-display" property
3. Font Preloading
or others as mentioned in https://css-tricks.com/fighting-foit-and-fout-together/
The simplest way to be used in Pega is use of font-display property, with which we can avoid a FOIT pretty easily, using the fallback or swap value on our choice.
- swap: Instructs the browser to use the fallback font to display the text until the custom font has fully downloaded. This may again lead to flash of unstyled text or FOUT.
- fallback: Acts as a compromise between the auto and swap values. The browser will hide the text for about 100ms and, if the font has not yet been downloaded, will use the fallback text. It will swap to the new font after it is downloaded, but only during a short swap period (probably 3 seconds).
We still need to be careful as font-display is not fully supported yet!
But finally, after adding this property, we were able to fix our FOIT issues (at least on browsers supporting this feature) which was coming across each iFrame.
Keep up to date on this post and subscribe to comments
- Seeking Advise on cache tables truncation in order to avoid performance issues
- Want to know the issues in Prod If the resource sharing scope from Shareable to Unshearable for eis/PRAdapterConnectionFactory resource in EngineBMT/CMT fragments is changed to avoid repeating warning messages.
- I am facing an issue similar to https://pdn.pega.com/community/product-support/question/avoid-confirm-close-prompt-message-when-no-real-change-wo-has
- Performance Issue while using Date Time Picker
- getsectionhtml causing performance issues