Skip to content

Conversation

@dcalhoun
Copy link
Member

@dcalhoun dcalhoun commented Jun 24, 2024

Proposed Changes

Minimize site form layout shift
The "Add site" dialog relies upon asynchronous name generation, which
ultimately populates the site path input. Conditionally rendering the
site path input based upon the populated site path value meant the input
popped into place during the modal open animation. Conditionally
rendering the input based upon the event handler only ensures the input
is present throughout the modal open animation.

Testing Instructions

Tip

Observing the difference in the provided screen recordings below requires slowly dragging the video scrubber.

Before After
initial-open-before initial-open-after
initial-open-before.mov
initial-open-after.mov
repeat-open-after.mov

1. Add site dialog always displays site path input

  1. Click "Add site" in the sidebar.
  2. Verify the site path input is always in-place, even during the modal
    animation the first time the modal is opened.

2. Edit site name excludes site path input

  1. Select or add a site.
  2. Navigate to the Settings panel.
  3. Click "Edit" next to the site name.
  4. Verify the site path input is not displayed.

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

The "Add site" dialog relies upon asynchronous name generation, which
ultimately populates the site path input. Conditionally rendering the
site path input based upon the populated site path value meant the input
popped into place during the modal open animation. Conditionally
rendering the input based upon the event handler only ensures the input
is present throughout the modal open animation.
@dcalhoun dcalhoun self-assigned this Jun 24, 2024
@dcalhoun dcalhoun marked this pull request as ready for review June 24, 2024 21:40
@dcalhoun dcalhoun requested a review from a team June 24, 2024 21:40
@dcalhoun
Copy link
Member Author

I consider the proposed changes an easy, low-quality solution, but I feel they are sufficient for the time being.

A more ideal solution might involve rendering a placeholder until the asynchronous work is complete. We might also postpone rendering of the actual dialog content until after both the modal open animation and asynchronous name generation complete to achieve optimal FPS.

Copy link
Contributor

@katinthehatsite katinthehatsite left a comment

Choose a reason for hiding this comment

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

The changes look good and fix the issue for me. Thanks for adding the fix!

@dcalhoun dcalhoun merged commit 851c054 into trunk Jun 25, 2024
@dcalhoun dcalhoun deleted the feat/minimize-site-form-layout-shift branch June 25, 2024 13:57
fluiddot pushed a commit that referenced this pull request Jun 27, 2024
The "Add site" dialog relies upon asynchronous name generation, which
ultimately populates the site path input. Conditionally rendering the
site path input based upon the populated site path value meant the input
popped into place during the modal open animation. Conditionally
rendering the input based upon the event handler only ensures the input
is present throughout the modal open animation.
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