Added new changes for flickering issues#7630
Open
Priyanka-2725 wants to merge 3 commits intoprimer:mainfrom
Open
Added new changes for flickering issues#7630Priyanka-2725 wants to merge 3 commits intoprimer:mainfrom
Priyanka-2725 wants to merge 3 commits intoprimer:mainfrom
Conversation
🦋 Changeset detectedLatest commit: b87b790 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
francinelucca
requested changes
Mar 5, 2026
Member
francinelucca
left a comment
There was a problem hiding this comment.
Thanks so much for the contribution 🙏🏽
Have some change requests but the core solution looks good!
| hasCalculatedRef.current = true | ||
| setIsInitialRender(false) | ||
| } | ||
| }, 100) // Short delay to allow resize observer to fire first |
Member
There was a problem hiding this comment.
do we know for a fact a delay is needed? wondering if it would work without it 🤔
CONTRIBUTOR_GUIDELINES_COMPLIANCE.md
Outdated
| @@ -0,0 +1,309 @@ | |||
| # Contributor Guidelines Compliance Check | |||
Member
There was a problem hiding this comment.
we do not use these type of documents in the repo so let's remove it 🙏🏽
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Avoid flickering when calculating ActionBar overflow #7447
Closes #7447
Overview
This PR fixes the flickering issue in ActionBar that occurs on initial render, especially noticeable on slower devices or with CPU throttling enabled.
Problem
On initial render, ActionBar displays all items briefly before calculating which items fit in the available space. This causes a visible flicker as items appear and then disappear, which is particularly distracting on slower devices.
Solution
Apply
visibility: hiddento the toolbar during initial render while width calculations are performed. Once calculations complete, the visibility style is removed and the toolbar appears with the correct items shown/hidden.Before
All items visible → Calculate → Some items disappear = Flicker ❌
After
Items hidden → Calculate → Correct items appear = No flicker ✅
Demo
The fix eliminates the flicker by showing a brief empty state (50-100ms) instead of showing all items and then hiding some. This is much less disruptive to the user experience.
Testing with CPU throttling (20x slowdown):
Changelog
Changed
visibility: hiddenduring initial render to prevent flickeringRollout strategy
Reasoning: This is a backwards compatible bug fix that improves user experience without changing any APIs or breaking existing functionality.
Implementation Details
Changes Made
Added state tracking for initial render
Added fallback timeout to ensure visibility
Updated resize observer to remove visibility hidden after calculation
Applied inline style conditionally
Edge Cases Handled
useIsomorphicLayoutEffectWhy
visibility: hiddeninstead of alternatives?getBoundingClientRect()display: noneTesting & Reviewing
Manual Testing Steps
Automated Testing
What to Review
Merge checklist
useIsomorphicLayoutEffectAdditional Notes
Performance Impact
Accessibility
Browser Compatibility
Breaking Changes
Related Issues/PRs
Closes #7447 - Avoid flickering when calculating ActionBar overflow