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

Position: preserve Individual Styles While Updating Position for Multi-Selected Blocks #68844

Conversation

yogeshbhutkar
Copy link
Contributor

@yogeshbhutkar yogeshbhutkar commented Jan 23, 2025

What, Why and How?

Fixes: #68843

Previously, modifying the Position attribute of multiple group blocks caused a bug where the custom styles of the first block were incorrectly applied to all other selected blocks, overriding their individual styles.

This PR resolves the issue by utilizing the Selected Client Ids to identify the currently selected blocks. It retrieves the individual attributes of each block and dispatches a single updateBlockAttributes action to update all selected blocks simultaneously while preserving their existing custom styles.

Testing Instructions

  1. Create multiple Group Blocks or blocks that support Position Property.
  2. Apply different custom backgrounds and text colors to these Blocks.
  3. Select all the Group Blocks and try applying the Position Property to all of them simultaneously.
  4. Notice, that changing the Position from Default to Stick or from Sticky to Default preserves the previous block styles.

Screencast

Screen.Recording.2025-01-23.at.10.57.00.AM.mov

@yogeshbhutkar yogeshbhutkar changed the title Enhance Position: update position of all the selected blocks Preserve Individual Styles While Updating Position for Multi-Selected Blocks Jan 23, 2025
@yogeshbhutkar yogeshbhutkar changed the title Preserve Individual Styles While Updating Position for Multi-Selected Blocks Position: preserve Individual Styles While Updating Position for Multi-Selected Blocks Jan 23, 2025
@yogeshbhutkar yogeshbhutkar marked this pull request as ready for review January 23, 2025 05:54
Copy link

Warning: Type of PR label mismatch

To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.

  • Type-related labels to choose from: [Type] Automated Testing, [Type] Breaking Change, [Type] Bug, [Type] Build Tooling, [Type] Code Quality, [Type] Copy, [Type] Developer Documentation, [Type] Enhancement, [Type] Experimental, [Type] Feature, [Type] New API, [Type] Task, [Type] Technical Prototype, [Type] Performance, [Type] Project Management, [Type] Regression, [Type] Security, [Type] WP Core Ticket, Backport from WordPress Core, Gutenberg Plugin.
  • Labels found: .

Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task.

1 similar comment
Copy link

Warning: Type of PR label mismatch

To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.

  • Type-related labels to choose from: [Type] Automated Testing, [Type] Breaking Change, [Type] Bug, [Type] Build Tooling, [Type] Code Quality, [Type] Copy, [Type] Developer Documentation, [Type] Enhancement, [Type] Experimental, [Type] Feature, [Type] New API, [Type] Task, [Type] Technical Prototype, [Type] Performance, [Type] Project Management, [Type] Regression, [Type] Security, [Type] WP Core Ticket, Backport from WordPress Core, Gutenberg Plugin.
  • Labels found: .

Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task.

Copy link

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: yogeshbhutkar <[email protected]>
Co-authored-by: Mamaduka <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@yogeshbhutkar
Copy link
Contributor Author

As stated here #68843 (comment), I'll be exploring some solutions to update this at the lower level as this might not be the best approach to proceed with.

@Mamaduka
Copy link
Member

Thanks, @yogeshbhutkar!

I suggest sharing your findings/proposal in the issue (#41260) for discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants