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

Improve layout shift caused by pattern previews loading in the inserter menus. #27494

Closed
Tracked by #31153
talldan opened this issue Dec 4, 2020 · 5 comments
Closed
Tracked by #31153
Labels
[Feature] Inserter The main way to insert blocks using the + button in the editing interface [Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced [Type] Enhancement A suggestion for improvement.

Comments

@talldan
Copy link
Contributor

talldan commented Dec 4, 2020

Is your feature request related to a problem? Please describe.
Related #27493

Using the search input in inserter menus can cause quite a lot of layout shift as the pattern previews load asynchronously.

This seems more noticeable in the Quick Inserter menu which has a smaller space. It's particularly noticeable when the popover is positioned above the inserter button, as the patterns cause everything above them to shift up and down.

Try:

  1. Adding enough content so that the trailing appender button is at the bottom of the screen.
  2. Clicking the trailing appender and then searching for random terms
  3. Notice how pattern previews don't display immediately, and when there's more than one the content can shift up and down a couple of times.

Describe the solution you'd like
Add some kind of loading placeholder to patterns. While we don't know ahead of time what size the preview will be, an approximate sized placeholder would help. Currently the preview is zero height when loading, and then it shifts to potentially 100-200px. The amount of shift could be reduced.

The placeholder aspect ratio could also be part of a pattern config if we'd like to be more precise, or alternatively the previous size could be cached and used for the placeholder so that the shift only happens the first time searching.

Describe alternatives you've considered
Couldn't think of any.

@talldan talldan added [Type] Enhancement A suggestion for improvement. [Feature] Inserter The main way to insert blocks using the + button in the editing interface Needs Design Needs design efforts. [Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced labels Dec 4, 2020
@mapk
Copy link
Contributor

mapk commented Dec 7, 2020

@talldan Is this a good example of the problem you're experiencing? My patterns load quickly, but I see the popover jumping up and down.

inserter

@talldan
Copy link
Contributor Author

talldan commented Dec 8, 2020

@mapk Yep, your patterns are loading a bit faster than I experience. I see more up and down movement as things pop into existence:
pattern-load

This might be related to me using a development build of the plugin, it does seem a bit quicker using a production version.

Do you think there's any room for improvement? Happy to close this if it looks like there's not much that can be done.

@mapk
Copy link
Contributor

mapk commented Dec 11, 2020

@talldan I see the hiccup now. Your proposal sounds like an idea to try if it's not too difficult.

I imagine it would be similar to this below. I'm using our general loading icon. On detection of patterns, show the loading icon until the patterns are ready to be displayed.

loading

@mapk mapk removed the Needs Design Needs design efforts. label Dec 11, 2020
@priethor priethor mentioned this issue Apr 23, 2021
22 tasks
@paaljoachim
Copy link
Contributor

I am really not sure what can be done here.
It does move up/down to show patterns that can be added.
We might need to think of a broader solution.

@talldan
Copy link
Contributor Author

talldan commented Mar 9, 2023

I think this can be closed, as the UI is quite different now.

@talldan talldan closed this as not planned Won't fix, can't repro, duplicate, stale Mar 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Inserter The main way to insert blocks using the + button in the editing interface [Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

3 participants