Skip to content

feat: FluentProvider applies style attributes defined by a renderer#26046

Merged
layershifter merged 1 commit into
microsoft:masterfrom
layershifter:fix/provider-attrs
Jan 3, 2023
Merged

feat: FluentProvider applies style attributes defined by a renderer#26046
layershifter merged 1 commit into
microsoft:masterfrom
layershifter:fix/provider-attrs

Conversation

@layershifter

@layershifter layershifter commented Dec 20, 2022

Copy link
Copy Markdown
Member

New Behavior

FluentProvider now applies the same style attributes as Griffel does:

const renderer = createDOMRenderer(document, {
  styleElementAttributes: {
    nonce: "random"
  }
});

ReactDOM.render(
  <RendererProvider renderer={renderer}>
    <FluentProvider />
  </RendererProvider>
);

With this change we will get following in DOM:

<!-- Tags created by Griffel -->
<style nonce="random" data-make-styles-bucket="d"></style>
<!-- Tags created by FluentProvider -->
<style nonce="random" id="fui-FluentProvider1"></style>

Docs changes

Documentation page was renamed to include also a guide on how to configure nonce for CSP.

Related Issue(s)

@size-auditor

size-auditor Bot commented Dec 20, 2022

Copy link
Copy Markdown

Asset size changes

Size Auditor did not detect a change in bundle size for any component!

Baseline commit: 811e28547fd69f37310582352758e7d84c8be944 (build)

@fabricteam

fabricteam commented Dec 20, 2022

Copy link
Copy Markdown
Collaborator

📊 Bundle size report

Package & Exports Baseline (minified/GZIP) PR Change
react-components
react-components: Button, FluentProvider & webLightTheme
59.812 kB
16.62 kB
59.888 kB
16.652 kB
76 B
32 B
react-components
react-components: Accordion, Button, FluentProvider, Image, Menu, Popover
188.779 kB
53.034 kB
188.856 kB
53.066 kB
77 B
32 B
react-components
react-components: FluentProvider & webLightTheme
34.276 kB
11.309 kB
34.379 kB
11.322 kB
103 B
13 B
react-provider
FluentProvider
16.343 kB
6.11 kB
16.446 kB
6.127 kB
103 B
17 B
Unchanged fixtures
Package & Exports Size (minified/GZIP)
react-portal-compat
PortalCompatProvider
6.069 kB
2.053 kB
🤖 This report was generated against 811e28547fd69f37310582352758e7d84c8be944

@codesandbox-ci

codesandbox-ci Bot commented Dec 20, 2022

Copy link
Copy Markdown

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 5bca96e:

Sandbox Source
@fluentui/react 8 starter Configuration
@fluentui/react-components 9 starter Configuration
flamboyant-tdd-elxq6h Issue #25421

@fabricteam

Copy link
Copy Markdown
Collaborator

🕵 fluentuiv8 Open the Visual Regressions report to inspect the 4 screenshots

✅ There was 0 screenshots added, 4 screenshots removed, 1041 screenshots unchanged, 0 screenshots with different dimensions and 0 screenshots with visible difference.

unknown 4 screenshots
Image Name Diff(in Pixels) Image Type
Pivot - Overflow.Root.Narrow - Last tab selected.chromium.png 0 Removed
Pivot - Overflow.Root.Narrow - Overflow menu.chromium.png 0 Removed
Pivot - Overflow.Tabs - RTL.Narrow - Last tab selected.chromium.png 0 Removed
Pivot - Overflow.Tabs - RTL.Narrow - Overflow menu.chromium.png 0 Removed

@fabricteam

Copy link
Copy Markdown
Collaborator

Perf Analysis (@fluentui/react-northstar)

⚠️ No perf measurements available

@fabricteam

fabricteam commented Dec 20, 2022

Copy link
Copy Markdown
Collaborator

🕵 fluentuiv9 No visual regressions between this PR and main

@fabricteam

Copy link
Copy Markdown
Collaborator

Perf Analysis (@fluentui/react)

No significant results to display.

All results

Scenario Render type Master Ticks PR Ticks Iterations Status
BaseButton mount 1193 1198 5000
Breadcrumb mount 2762 2787 1000
Checkbox mount 2649 2681 5000
CheckboxBase mount 2384 2366 5000
ChoiceGroup mount 4234 4258 5000
ComboBox mount 1183 1233 1000
CommandBar mount 9280 9274 1000
ContextualMenu mount 10220 10146 1000
DefaultButton mount 1351 1360 5000
DetailsRow mount 3418 3358 5000
DetailsRowFast mount 3408 3368 5000
DetailsRowNoStyles mount 3227 3206 5000
Dialog mount 2950 2994 1000
DocumentCardTitle mount 575 577 1000
Dropdown mount 3161 3132 5000
FocusTrapZone mount 1925 1935 5000
FocusZone mount 1932 1930 5000
GroupedList mount 1812 2018 2
GroupedList virtual-rerender 1077 1064 2
GroupedList virtual-rerender-with-unmount 1580 1587 2
GroupedListV2 mount 555 570 2
GroupedListV2 virtual-rerender 534 545 2
GroupedListV2 virtual-rerender-with-unmount 568 565 2
IconButton mount 1805 1786 5000
Label mount 748 752 5000
Layer mount 4130 4201 5000
Link mount 849 851 5000
MenuButton mount 1609 1622 5000
MessageBar mount 2347 2280 5000
Nav mount 3019 3066 1000
OverflowSet mount 1419 1418 5000
Panel mount 2488 2487 1000
Persona mount 1287 1265 1000
Pivot mount 1508 1507 1000
PrimaryButton mount 1470 1489 5000
Rating mount 6932 6926 5000
SearchBox mount 1477 1491 5000
Shimmer mount 2918 2877 5000
Slider mount 2104 2092 5000
SpinButton mount 4251 4261 5000
Spinner mount 831 831 5000
SplitButton mount 2829 2801 5000
Stack mount 860 856 5000
StackWithIntrinsicChildren mount 2245 2254 5000
StackWithTextChildren mount 4941 4956 5000
SwatchColorPicker mount 9299 9350 5000
TagPicker mount 2272 2341 5000
TeachingBubble mount 76759 74037 5000
Text mount 812 816 5000
TextField mount 1522 1544 5000
ThemeProvider mount 1448 1445 5000
ThemeProvider virtual-rerender 1140 1137 5000
ThemeProvider virtual-rerender-with-unmount 1997 2002 5000
Toggle mount 1143 1145 5000
buttonNative mount 535 534 5000

@fabricteam

Copy link
Copy Markdown
Collaborator

🕵 FluentUI-v0 No visual regressions between this PR and main

@layershifter layershifter force-pushed the fix/provider-attrs branch 5 times, most recently from 0ddf294 to 7febd10 Compare January 3, 2023 17:23
@layershifter layershifter marked this pull request as ready for review January 3, 2023 17:24
@layershifter layershifter requested review from a team as code owners January 3, 2023 17:24
```js
import { createDOMRenderer } from '@fluentui/react-components';

const renderer = createDOMRenderer(document, {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would also add the usage of the renderer with the provider in this example

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done 👍

@fabricteam

fabricteam commented Jan 3, 2023

Copy link
Copy Markdown
Collaborator

Perf Analysis (@fluentui/react-components)

No significant results to display.

All results

Scenario Render type Master Ticks PR Ticks Iterations Status
Avatar mount 1279 1294 5000
Button mount 920 908 5000
FluentProvider mount 1485 1498 5000
FluentProviderWithTheme mount 574 586 10
FluentProviderWithTheme virtual-rerender 530 545 10
FluentProviderWithTheme virtual-rerender-with-unmount 578 582 10
MakeStyles mount 1973 1960 50000
Persona mount 2823 2773 5000
SpinButton mount 2357 2350 5000

@layershifter layershifter merged commit 5b9042f into microsoft:master Jan 3, 2023
@layershifter layershifter deleted the fix/provider-attrs branch January 3, 2023 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: styleElementAttributes doesn't apply to fui-FluentProvider style element

5 participants