SharePoint / sp-dev-docs

SharePoint & Viva Connections Developer Documentation
https://docs.microsoft.com/en-us/sharepoint/dev/
Creative Commons Attribution 4.0 International
1.25k stars 1.01k forks source link

Problem with font from Brand center and SPFx/FUI8 & FUI9 #9830

Open rgcircum opened 4 months ago

rgcircum commented 4 months ago

Target SharePoint environment

SharePoint Online

What SharePoint development model, framework, SDK or API is this about?

💥 SharePoint Framework

Developer environment

Windows

What browser(s) / client(s) have you tested

Additional environment details

Describe the bug / error

On a SPFx project, If use the predefined variable (ex:fontFamilyCustomFont800) to override font in dialog, callout, navigation, dropdown, etc (all element have no inline renderer) ... the variable is undefined (see screenshot). image

I think it's coming because the fonts variables is created in first Fluent provider, and all callout, dialog, ect is rendered outside of this div.

I tried with FUI8 & FUI9 lib.

[edit] - the font override do not work with applicationCustomizer, Header & Footer :/

Steps to reproduce

  1. Create SPFx project with themeProvider & dialog and apply font variable on tittle of dialog.

Expected behavior

That the fonts are also applied to the floating elements.

StfBauer commented 4 months ago

Fluent Ui always appended the dialog before the body and positioned it then fixed accross the screen. That's why we never use the Fluent UI Dialog and use a native HTML <dialog> Element

CSS Variables are always scoped to the container they have been applied to not to the ouside elements.

I tested the font variable on the custom PnP SPFx Live Reloader - The font gets applied wihout any problem on this App Customiser.

image

The problem you might face that a specifc font weight is not available which then falls back a Times New Roman like in this case.

image

This problem also become emminent in first party web part, where the rendered font falls back to the default browser font "Times New Roman".

It's still not yet an optimal implementation.

rgcircum commented 3 months ago

The dialog box is just an example, it does it on all floating elements (outside the first theme provider of SP), callout, Drawer, Panel, Dropdown, navigation .... and especially on customizer applications..

The problem is that we do not have control over the provider generated with the right variables, it should be generated at the Body tag level

image

Hopefully this will be fixed when it's in GA, because it's unusable.