Fix layout jank when scrolling back up to post body #1660
Merged
+4
−1
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.
Pull Request Description
This PR fixes an issue where scrolling up on the post page often times results in a layout shift. This issue comes up due to the use of
expandable
in the post body. Whenever the post body is re-introduced into the widget tree (lazy loading of the sliver list), the expandable animation replays and causes the whole layout to shift downwards to accomodate for the body expansion.This is an example of the layout shift that occurs in the post body (issue occurs at ~7 seconds in):
ScreenRecording_01-17-2025.11-20-08_1.mp4
The fix here is to apply the
AutomaticKeepAliveClientMixin
to_PostSubviewState
in order to stop the expansion animation from happening:ScreenRecording_01-17-2025.11-39-48_1.mp4
Issue Being Fixed
Issue Number: N/A
Screenshots / Recordings
Checklist
semanticLabel
s where applicable for accessibility?