Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🕵🏾‍♀️ visual changes to review in the Visual Change Report

vr-tests-react-components/Menu 1 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/Menu.Nested Submenus Small Viewport Stacked.nested menu.chromium.png 856 Changed
vr-tests-react-components/Positioning 2 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/Positioning.Positioning end.chromium.png 723 Changed
vr-tests-react-components/Positioning.Positioning end.updated 2 times.chromium.png 12 Changed
vr-tests-react-components/ProgressBar converged 3 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/ProgressBar converged.Indeterminate + thickness - Dark Mode.default.chromium.png 51 Changed
vr-tests-react-components/ProgressBar converged.Indeterminate + thickness - High Contrast.default.chromium.png 33 Changed
vr-tests-react-components/ProgressBar converged.Indeterminate + thickness.default.chromium.png 81 Changed
vr-tests-react-components/Skeleton converged 1 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/Skeleton converged.Translucent Skeleton with rectangle.default.chromium.png 10 Changed
vr-tests-react-components/TagPicker 3 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/TagPicker.disabled - Dark Mode.disabled input hover.chromium.png 658 Changed
vr-tests-react-components/TagPicker.disabled - High Contrast.disabled input hover.chromium.png 1319 Changed
vr-tests-react-components/TagPicker.disabled.disabled input hover.chromium.png 677 Changed

There were 3 duplicate changes discarded. Check the build logs for more information.

"type": "patch",
"comment": "fix(MessageBar): v9 MessageBar Resize Flicker Fix",
"packageName": "@fluentui/react-message-bar",
"email": "jiangemma@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ export function useMessageBarReflow(enabled: boolean = false): {
// TODO: exclude types from this lint rule: https://github.com/microsoft/fluentui/issues/31286

const resizeObserverRef = React.useRef<ResizeObserver | null>(null);
const prevInlineSizeRef = React.useRef(-1);

// Width required to fit the single line layout, recorded when we switch to the reflowed layout.
// Used to switch back to single line only once there is enough room, avoiding flicker during resize.
const singleLineWidthRef = React.useRef(Number.POSITIVE_INFINITY);

const handleResize: ResizeObserverCallback = React.useCallback(
entries => {
Expand Down Expand Up @@ -47,21 +50,21 @@ export function useMessageBarReflow(enabled: boolean = false): {

let nextReflowing: boolean | undefined;

// No easy way to really determine when the single line layout will fit
// Just keep try to set single line layout as long as the size is growing
// Will cause flickering when size is being adjusted gradually (i.e. drag) - but this should not be a common case
// Switching between layouts is driven by a recorded threshold.
// Only switch back to the single line layout once there is enough room to fit it.
if (reflowingRef.current) {
if (prevInlineSizeRef.current < inlineSize) {
if (inlineSize >= singleLineWidthRef.current) {
nextReflowing = false;
}
} else {
const scrollWidth = target.scrollWidth;
if (inlineSize < scrollWidth) {
nextReflowing = true;
// Record the width required to fit the single line layout so we know when it's safe to switch back.
singleLineWidthRef.current = scrollWidth;
}
}

prevInlineSizeRef.current = inlineSize;
if (typeof nextReflowing !== 'undefined' && reflowingRef.current !== nextReflowing) {
reflowingRef.current = nextReflowing;
forceUpdate();
Expand Down
Loading