ivodolenc/nuxt-font-loader

Change default setting from 'optional' to 'swap' for `display`

Closed this issue · 2 comments

Steps to Reproduce

Use a local font without setting the display property

Current Behavior

The default value is 'optional' and so the font is loaded with font-display: optional

Expected Behavior

Because of other modules & swap being kind of the standard value around. Therefore, I would expect swap to the default value

Additional Details

As explained in the expected behaviour part, I expected the default to be swap and probably misread the documentation at first. As a result, I spent quite a lot of time debugging and thinking about why my fonts wouldn't load on some devices from clients. In general, I think swap is more used and has a less 'error-prone' behaviour.

I know it is a small thing, but I think it would improve the default usage of the configuration (and some headaches for people who encounter the same situation as me.)

Version

2.3.5

Do want to add: thanks for this module. Works like a charm after I configured my display setting

Hi, thanks for your interest in this module.

Since this is not a bug, I'm moving it to discussions.


Also, option fontDisplay is somewhat of a personal preference. This can lead to some behavior that can be viewed differently.

The swap option isn't ideal since it creates quick flashes or content shifts if the fonts are not loading fast enough.

But I'm open for disscussion.

I think swap is more used and has a less 'error-prone' behaviour.

Why you think that it's a less error-prone? I don't agree with this. It is simple, if you specified a local font, it loads it according to the defined rules, you have all control.

Think of it in a way that if you are a beginner and you specify a local font, after each page load, a short flash and a quick font change occur. You might also think something is wrong, right?

Official docs for font-display.