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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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

📊 Bundle size report

Package & Exports Baseline (minified/GZIP) PR Change
react-components
react-components: entire library
1.164 MB
291.337 kB
1.164 MB
291.335 kB
32 B
-2 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.799 kB
64.464 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 928fdced4834242a829327af1db00f51f9dbd382

Copy link

Pull request demo site: URL

@@ -0,0 +1,7 @@
{
Copy link
Collaborator

Choose a reason for hiding this comment

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

🕵🏾‍♀️ visual regressions to review in the fluentuiv9 Visual Regression Report

Avatar Converged 2 screenshots
Image Name Diff(in Pixels) Image Type
Avatar Converged.badgeMask.chromium.png 39 Changed
Avatar Converged.Badge Mask RTL.chromium.png 10 Changed

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
3 participants