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

Not all styles panels are visually updated on copy/paste block styles #47368

Closed
ndiego opened this issue Jan 24, 2023 · 7 comments · Fixed by #47590 or #47727
Closed

Not all styles panels are visually updated on copy/paste block styles #47368

ndiego opened this issue Jan 24, 2023 · 7 comments · Fixed by #47590 or #47727
Assignees
Labels
[Feature] Blocks Overall functionality of blocks [Type] Bug An existing feature does not function as intended

Comments

@ndiego
Copy link
Member

ndiego commented Jan 24, 2023

Description

Not all pasted styles are "visually" applied in the inspector panel when copying and pasting block styles. The styles are technically applied to the block, but tools that were not already applied to a styles panel, do not get updated. If you deselect the block and then reselect, all styles panels are correctly updated.

Step-by-step reproduction instructions

  1. Add a heading block and add many custom styles to it, including padding and margin.
  2. Add another unstyled heading block.
  3. Copy the styles for the first heading to the unstyles heading block.
  4. See that the applied padding and margin styles do not show up in the Dimensions panel even though they are applied to the block. If you look closely, you will also see that only Typography tools that were already applied to the unstyled heading block get updated.
  5. Click off of the block and then reselect. See that the Dimensions panel is displaying as expected.

Screenshots, screen recording, code snippet

copy-past-styles-error

Environment info

  • WordPress 6.1.1
  • Gutenberg trunk
  • TT3

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

@ndiego ndiego added [Type] Bug An existing feature does not function as intended [Feature] Blocks Overall functionality of blocks labels Jan 24, 2023
@ndiego ndiego changed the title Not all styles panel are visually updated on copy/paste block styles Not all styles panels are visually updated on copy/paste block styles Jan 24, 2023
@ndiego
Copy link
Member Author

ndiego commented Jan 24, 2023

cc @kevin940726

@glendaviesnz glendaviesnz self-assigned this Jan 31, 2023
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Jan 31, 2023
@richtabor
Copy link
Member

Confirmed this is happening. Not ideal, but not immediate imo.

@glendaviesnz
Copy link
Contributor

Possible fix here #47590

@richtabor
Copy link
Member

Possible fix here #47590

I missed that, nice! Looks good to me.

@glendaviesnz
Copy link
Contributor

Re-opening this as the first fix turned out to be too fragile on trunk

@glendaviesnz
Copy link
Contributor

glendaviesnz commented Feb 2, 2023

Doing this at the ToolsPanel level seems more robust, but will look further at it tomorrow to see if there is a way to get the ToolsPanelItem to do this by default rather than having to set the isShownByDefault prop on every instance.

@aaronrobertshaw
Copy link
Contributor

I've created an alternative PR ( #47727 ) that might help address this issue.

One thing to note with that PR is that if an optional control such as the Heading block's padding or margin controls has been toggled on for display or previously customized, it will still be displayed after block styles are pasted. It will reflect the current value though, so this might potentially help reflect to the user what has changed. Interested in others' thoughts on that, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Blocks Overall functionality of blocks [Type] Bug An existing feature does not function as intended
Projects
No open projects
5 participants