Skip to content

BREAKING: FluentProvider now sets a default css line-height#23279

Merged
behowell merged 7 commits into
microsoft:masterfrom
behowell:provider-line-height
May 30, 2022
Merged

BREAKING: FluentProvider now sets a default css line-height#23279
behowell merged 7 commits into
microsoft:masterfrom
behowell:provider-line-height

Conversation

@behowell

@behowell behowell commented May 26, 2022

Copy link
Copy Markdown
Contributor

Current Behavior

FluentProvider sets the font family, size, and weight, but does not set line height. Plain body text inside a FluentProvider context doesn't match the design spec.

New Behavior

FluentProvider now sets line-height.

This has the potential to change layout of any text in an app that doesn't explicitly set line-height. In some cases, this will result in fixing layout bugs, but it could also cause issues if a component intended to change the typography but didn't also specify line-height.

Related Issue(s)

This splits out just the FluentProvider change from @andrefcdias PR #23254. In discussion with the team, we decided to hold on the Text component changes from the PR pending further discussion. However, we don't want to delay the FluentProvider change before the Text decision is finalized.

@codesandbox-ci

codesandbox-ci Bot commented May 26, 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 5f15309:

Sandbox Source
@fluentui/react 8 starter Configuration
@fluentui/react-components 9 starter Configuration

@fabricteam

fabricteam commented May 26, 2022

Copy link
Copy Markdown
Collaborator

📊 Bundle size report

Package & Exports Baseline (minified/GZIP) PR Change
react-components
react-components: Accordion, Button, FluentProvider, Image, Menu, Popover
181.147 kB
50.599 kB
181.217 kB
50.609 kB
70 B
10 B
react-components
react-components: FluentProvider & webLightTheme
34.078 kB
11.098 kB
34.148 kB
11.124 kB
70 B
26 B
react-provider
FluentProvider
14.127 kB
5.299 kB
14.197 kB
5.33 kB
70 B
31 B

🤖 This report was generated against c772544307148c418d6f37955a37380234dea506

@fabricteam

fabricteam commented May 26, 2022

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 898 920 5000
Button mount 551 561 5000
FluentProvider mount 1846 1890 5000
FluentProviderWithTheme mount 295 285 10
FluentProviderWithTheme virtual-rerender 269 244 10
FluentProviderWithTheme virtual-rerender-with-unmount 312 316 10
MakeStyles mount 1576 1560 50000

@size-auditor

size-auditor Bot commented May 26, 2022

Copy link
Copy Markdown

Asset size changes

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

Baseline commit: c772544307148c418d6f37955a37380234dea506 (build)

@behowell

behowell commented May 26, 2022

Copy link
Copy Markdown
Contributor Author

Regarding the screener regressions, I think it should be ok to approve of all of them:

  • Badge/CounterBadge
  • Card
    • The changes to the body text inside the card are actually being fixed by this PR. The line height is now correct.
    • One of the screener stories used <h1> elements internally, which ended up with the wrong line height after this change. However, after looking through the tests, those scenarios were entirely redundant with other stories, so I removed them.
  • Image
    • The broken image alt text now has the same line height as body text. If anything, it's more correct now (and really doesn't matter).
  • MakeStyles and Positioning
    • These tests are using some filler text, which now has the right line height. It doesn't affect production code.

Comment on lines -64 to -93
.addStory(
'appearance',
() => (
<div style={{ display: 'flex', flexDirection: 'column', gap: '16px' }}>
<div>
<h1>Filled</h1>
<Card appearance="filled">
<SampleCardContent />
</Card>
</div>
<div>
<h1>Filled alternative</h1>
<Card appearance="filled-alternative">
<SampleCardContent />
</Card>
</div>
<div>
<h1>Outline</h1>
<Card appearance="outline">
<SampleCardContent />
</Card>
</div>
<div>
<h1>Subtle</h1>
<Card appearance="subtle">
<SampleCardContent />
</Card>
</div>
</div>
),

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

These stories use the <h1> tag, which was ending up with the wrong line height after this change (bug in the test). It could have been replaced by <Title1 as="h1">; however, this is all entirely redundant with the "appearance interactive - Filled", etc. stories below, which are testing the same appearances. So I deleted them.

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.

This is NOT redundant. Filled and Interactive Filled use different styles, see https://github.com/microsoft/fluentui/blob/master/packages/react-components/react-card/src/components/Card/useCardStyles.ts#L54.
Please add the test back and either change the headers or let the visual regression test fail, which means it's doing it's job correctly, and we can approve as it's intended.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ok I'll revert these changes, thanks!

@behowell

Copy link
Copy Markdown
Contributor Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 3 pipeline(s).

@behowell
behowell marked this pull request as ready for review May 26, 2022 23:00
@behowell
behowell requested review from a team as code owners May 26, 2022 23:00

@theerebuss theerebuss left a comment

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.

Theme provider changes are good, but the Card stories need to be re-added

Comment on lines -64 to -93
.addStory(
'appearance',
() => (
<div style={{ display: 'flex', flexDirection: 'column', gap: '16px' }}>
<div>
<h1>Filled</h1>
<Card appearance="filled">
<SampleCardContent />
</Card>
</div>
<div>
<h1>Filled alternative</h1>
<Card appearance="filled-alternative">
<SampleCardContent />
</Card>
</div>
<div>
<h1>Outline</h1>
<Card appearance="outline">
<SampleCardContent />
</Card>
</div>
<div>
<h1>Subtle</h1>
<Card appearance="subtle">
<SampleCardContent />
</Card>
</div>
</div>
),

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.

This is NOT redundant. Filled and Interactive Filled use different styles, see https://github.com/microsoft/fluentui/blob/master/packages/react-components/react-card/src/components/Card/useCardStyles.ts#L54.
Please add the test back and either change the headers or let the visual regression test fail, which means it's doing it's job correctly, and we can approve as it's intended.

@behowell
behowell enabled auto-merge (squash) May 27, 2022 21:32
@behowell behowell changed the title BREAKING: FluentProvider now adds line-height by default BREAKING: FluentProvider now sets a default css line-height May 27, 2022
@behowell

Copy link
Copy Markdown
Contributor Author

@andrefcdias I reverted the Card changes. I also accepted all of the screener changes and set the PR to auto-merge after you approve, if it looks good. Thanks!

@theerebuss theerebuss left a comment

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.

LGTM

@behowell
behowell merged commit eb3bf4d into microsoft:master May 30, 2022
marwan38 pushed a commit to marwan38/fluentui that referenced this pull request Jun 13, 2022
…oft#23279)

FluentProvider now sets `line-height` on its div, to go along with the other default font properties.
@behowell
behowell deleted the provider-line-height branch July 25, 2022 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Development

Successfully merging this pull request may close these issues.

6 participants