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

Dimensions Panel: Inconsistent menu item positions #49124

Closed
aaronrobertshaw opened this issue Mar 16, 2023 · 2 comments · Fixed by #49222
Closed

Dimensions Panel: Inconsistent menu item positions #49124

aaronrobertshaw opened this issue Mar 16, 2023 · 2 comments · Fixed by #49222
Assignees
Labels
[Block] Cover Affects the Cover Block - used to display content laid over a background image [Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi [Feature] UI Components Impacts or related to the UI component system [Type] Bug An existing feature does not function as intended

Comments

@aaronrobertshaw
Copy link
Contributor

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

  1. Edit a post and add a Cover block
  2. Select the cover block and switch to the styles tab
  3. Without hovering over any dimensions panel controls, open the panel's menu. Not the min-height controls position.
  4. Close the panel's menu, hover the padding control (no other interaction required), re-open the panel's menu.
  5. 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

@aaronrobertshaw aaronrobertshaw added [Type] Bug An existing feature does not function as intended [Feature] UI Components Impacts or related to the UI component system [Block] Cover Affects the Cover Block - used to display content laid over a background image [Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi labels Mar 16, 2023
@glendaviesnz
Copy link
Contributor

glendaviesnz commented 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 panelId remains 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
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Cover Affects the Cover Block - used to display content laid over a background image [Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi [Feature] UI Components Impacts or related to the UI component system [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants