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 layout jank when scrolling back up to post body #1660

Merged
merged 1 commit into from
Jan 24, 2025

Conversation

hjiangsu
Copy link
Member

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

  • If a new package was added, did you ensure it uses an appropriate license and is actively maintained?
  • Did you use localized strings (and added appropriate descriptions) where applicable?
  • Did you add semanticLabels where applicable for accessibility?

Copy link
Member

@micahmo micahmo left a comment

Choose a reason for hiding this comment

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

Very nice!

@hjiangsu hjiangsu merged commit b60ae91 into develop Jan 24, 2025
1 check passed
@hjiangsu hjiangsu deleted the fix/post-view-resize branch January 24, 2025 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants