Repository navigation
Closed
Labels
[Block] CoverAffects the Cover Block - used to display content laid over a background image[Feature] Design ToolsTools that impact the appearance of blocks both to expand the number of tools and improve the experi[Feature] UI ComponentsImpacts or related to the UI component system[Type] BugAn existing feature does not function as intended
Description
Description
Hovering padding or margin controls can result in the Dimensions Panel's menu items reordering.
This appears to be a regression introduced with the on hover visualizers for padding and margin in #44955.
Expected Behaviour
Menu items retain their position irrespective of what panel items are moused over. This was the behaviour in the commit prior to #44955 in 5a82cf5.
Actual Behaviour
The Cover block's menu items are reordered when the padding or margin controls are moused over.
cc/ @glendaviesnz
Step-by-step reproduction instructions
- Edit a post and add a Cover block
- Select the cover block and switch to the styles tab
- Without hovering over any dimensions panel controls, open the panel's menu. Not the min-height controls position.
- Close the panel's menu, hover the padding control (no other interaction required), re-open the panel's menu.
- Note that the min-height control is now in a different position.
Screenshots, screen recording, code snippet
| Before #44955 | After #4955 |
|---|---|
Screen.Recording.2023-03-16.at.4.06.04.pm.mp4 |
Screen.Recording.2023-03-16.at.4.03.26.pm.mp4 |
Environment info
- WP 6.1
- Gutenberg:
trunk
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
Metadata
Metadata
Assignees
Labels
[Block] CoverAffects the Cover Block - used to display content laid over a background image[Feature] Design ToolsTools that impact the appearance of blocks both to expand the number of tools and improve the experi[Feature] UI ComponentsImpacts or related to the UI component system[Type] BugAn existing feature does not function as intended
Activity
glendaviesnz commentedon Mar 19, 2023
Not sure what is going on here. I suspect it is something to do with a rerender of this component, but not sure why that changes the order as the
panelIdremains consistent. It is not easy to work out from the code how these panel items are ordered currently. You might have more luck tracking down the issue @aaronrobertshaw with your knowledge about how these menu items are supposed to work.aaronrobertshaw commentedon Mar 19, 2023
The ToolsPanelItems register themselves. As you are rendering them into a SlotFill, those items will be in the order of the fills. Unfortunately, the order of fills isn't guaranteed, so we need to prevent unnecessary rerendering due to props changing.
There seems to be additional rerendering introduced by the on-hover callbacks. I have a vague memory of bringing up that rendering on the initial PR but I could be wrong.