Improve layout shift caused by pattern previews loading in the inserter menus. #27494
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.
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:
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.
The text was updated successfully, but these errors were encountered: