SAP / ui5-webcomponents

UI5 Web Components - the enterprise-flavored sugar on top of native APIs! Build SAP Fiori user interfaces with the technology of your choice.
https://sap.github.io/ui5-webcomponents/
Apache License 2.0
1.52k stars 263 forks source link

[Feature Request]: Make disabling of default font loading more straight forward #8991

Closed Jak-Ch-ll closed 2 months ago

Jak-Ch-ll commented 4 months ago

Feature Request Description

This is partially a feature request but also a bug report

Our projects have the technical requirements of loading the fonts locally and not from a third-party server. While trying to override the font loading according to the docs I stumbled upon an issue in combination with Nuxt/Unhead.

To analyze that issue, I was debugging through the UI5 source code and found the function responsible for checking that the style tag exists. I also wanted to see if there were any relevant recent changes in the main branch and here comes the 'bug': With refactor #8496 the function was slimmed down and is now only checking for adopted stylesheets, which a custom style tag in most cases does not fall under.

Proposed Solution

Instead of bringing back the rather awkward way of overriding the font loading, I propose a new configuration option for v2.0, that disables the default font loading. Then leave any kind of custom font loading to the user.

The migration would be rather simple, as the existing style tag would still work for setting the font faces. Only the configuration option would need to be set. The user would then be free to set the font faces however their application or framework requires it.

Proposed Alternatives

Bringing back the old behaviour. I don't really like the way, it is currently done, because I feel like this is unintuitive. A configuration option would be self-explanatory, while a (potentially empty) style tag with a data attribute would at least require a link to the UI5 docs.

Organization

aconso

Additional Context

I set the priority to High, as some change is necessary before v2.0 is released.

From my current understanding of the code base, this would relatively simple to implement, Once the configuration option is added, only an additional change would be needed here: https://github.com/SAP/ui5-webcomponents/blob/2e97c03fc8f9d00c7d9bdd8c1ceb63bac13b7e32/packages/base/src/FontFace.ts#L19-L23

Priority

High

Privacy Policy

GerganaKremenska commented 4 months ago

Hello @SAP/ui5-webcomponents-topic-core, take a look of this feature request.

Best Regards, Gergana