Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove forced synchronous layout in Drawer #33665

Merged
merged 2 commits into from
Jan 22, 2025

Conversation

spmonahan
Copy link
Contributor

@spmonahan spmonahan commented Jan 15, 2025

Previous Behavior

Drawer was forcing synchronous layout by reading scrollTop, scrollHeight and clientHeight in its getScrollState() function.

This change defers the read with a requestAnimationFrame() so the browser can read the values from the previous frame, removing the forced synchronous layout.

New Behavior

No forced synchronous layout

Related Issue(s)

References

Before profile

Chrome DevTools showing the forced style recalc and layout

After profile

Chrome DevTools showing no forced style recalc and layout

@spmonahan spmonahan requested review from marcosmoura and a team as code owners January 15, 2025 18:55
Drawer was forcing synchronous layout by reading scrollTop,
scrollHeight and clientHeight in its getScrollState() function.

This change defers the read with a requestAnimationFrame() so the
browser can read the values from the previous frame, removing the
forced synchronous layout.
@spmonahan spmonahan force-pushed the fix/drawer-forced-recalc branch from 9975f60 to 23e9e1d Compare January 15, 2025 18:56
@microsoft-github-policy-service microsoft-github-policy-service bot added the Component: Drawer The Fluent v9 Drawer component label Jan 15, 2025
Copy link

github-actions bot commented Jan 15, 2025

📊 Bundle size report

Package & Exports Baseline (minified/GZIP) PR Change
react-components
react-components: entire library
1.166 MB
292.035 kB
1.166 MB
292.034 kB
40 B
-1 B
Unchanged fixtures
Package & Exports Size (minified/GZIP)
react-components
react-components: Button, FluentProvider & webLightTheme
69.236 kB
20.182 kB
react-components
react-components: Accordion, Button, FluentProvider, Image, Menu, Popover
222.641 kB
64.474 kB
react-components
react-components: FluentProvider & webLightTheme
44.473 kB
14.597 kB
react-portal-compat
PortalCompatProvider
8.39 kB
2.64 kB
react-timepicker-compat
TimePicker
108.551 kB
36.094 kB
🤖 This report was generated against e706ac0ac7f2aa46a7f6f48efda24938a539a835

Copy link

Pull request demo site: URL

@spmonahan spmonahan merged commit d9e5810 into microsoft:master Jan 22, 2025
16 checks passed
marcosmoura added a commit that referenced this pull request Jan 23, 2025
…/chore--slot-API-react-v17/18-support

* chore/react-18-support: (516 commits)
  update some deps to React 18
  test(react-color-picker): Added cy and a11y tests for sliders (#33609)
  fix(react-charting): Centre align Gauge chart (#33710)
  fix(vr-tests): set a fixed value for culture prop in charts (#33690)
  release: applying package updates - react v8
  feat(react-charting): Heatmap text color based on Contrast Ratio (#33659)
  test(color-picker): Added VR tests for ColorSlider and AlphaSlider (#33672)
  fix: remove forced synchronous layout in Drawer (#33665)
  feat(declarative-chart): Support for Dashed and Dotted lines (#33694)
  release: applying package updates - react-components
  feat: add vite sandbox template (#33631)
  ci: trigger VRT PR workflow only against testing branch (#33701)
  chore(deps-dev): bump vite from 6.0.7 to 6.0.9 (#33698)
  release: applying package updates - react v8
  BaseFloatingPicker - Release references held by Async (#33685)
  feature(react-tag-picker): single line layout (#32247)
  feature(react-tree): introduces navigationMode property (#33658)
  bugfix: secondaryContent not displaying properly (#33689)
  release: applying package updates - react v8
  fix(react-charting): resolve overlapping bars issue in histogram (#33695)
  ...
marcosmoura added a commit that referenced this pull request Jan 23, 2025
…/chore--slot-API-react-v17/18-support

* chore/react-18-support: (516 commits)
  update some deps to React 18
  test(react-color-picker): Added cy and a11y tests for sliders (#33609)
  fix(react-charting): Centre align Gauge chart (#33710)
  fix(vr-tests): set a fixed value for culture prop in charts (#33690)
  release: applying package updates - react v8
  feat(react-charting): Heatmap text color based on Contrast Ratio (#33659)
  test(color-picker): Added VR tests for ColorSlider and AlphaSlider (#33672)
  fix: remove forced synchronous layout in Drawer (#33665)
  feat(declarative-chart): Support for Dashed and Dotted lines (#33694)
  release: applying package updates - react-components
  feat: add vite sandbox template (#33631)
  ci: trigger VRT PR workflow only against testing branch (#33701)
  chore(deps-dev): bump vite from 6.0.7 to 6.0.9 (#33698)
  release: applying package updates - react v8
  BaseFloatingPicker - Release references held by Async (#33685)
  feature(react-tag-picker): single line layout (#32247)
  feature(react-tree): introduces navigationMode property (#33658)
  bugfix: secondaryContent not displaying properly (#33689)
  release: applying package updates - react v8
  fix(react-charting): resolve overlapping bars issue in histogram (#33695)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Drawer The Fluent v9 Drawer component
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: useDrawerBody() forces style recalculations
4 participants