WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.19k stars 4.06k forks source link

Don't expose pattern shuffle feature when content has been edited #62288

Open fabiankaegy opened 1 month ago

fabiankaegy commented 1 month ago

WordPress 6.6 introduces a new feature that allows users to hit a "Shuffle" button in the toolbar of any inserted pattern. This shuffle button then replaces the entire pattern with other patterns that are in the same category.

This is a really cool and powerful feature because it makes it easy for someone to cycle though their options and find what they want to use.

But the feature has one large problem as it stands today in Gutenberg 18.5 RC1. The shuffle button doesn't just exist for newly inserted patterns before they are modified but it shows for any patterns on the page.

When a user clicks on the shuffle button after they have already entered/modified any of the content in the pattern, their content just gets replaced/overwritten with the default content stored in the pattern.

This is a very destructive action that should be prevented at all cost.


From my perspective, there are a few options we should look at before we ship WordPress 6.6:

  1. Find a way to only show the shuffle button while patterns are untouched (have no modifications)
  2. Allow theme authors / patter authors to opt out of the shuffle feature
  3. Remove shuffling from the 6.6 release until we have figured out a way to solve this problem
ndiego commented 1 month ago

Here's a quick video of my experience with the new shuffle feature.

https://github.com/WordPress/gutenberg/assets/4832319/f37a8ea1-e4c3-48e8-ab6b-0cfc7a399c27

TLDR:

In my testing, I also discovered a bug with synced patterns that are included in the same pattern category as the pattern being shuffled.

colorful-tones commented 1 month ago

Pattern shuffling seems like a whimsical fun idea, and WP could always use a bit of those. It reminds me of the color palette randomizer. I'm not sure if it is still in the codebase and under Experiments? Perhaps shuffling and color randomizer could get a proposal for a separate plugin: Randomizer Experiments plugin or something? 🤔

fabiankaegy commented 1 month ago

@WordPress/gutenberg-core @WordPress/gutenberg-design would love to get more thoughts on this as I think it is important for us to make a decision here asap in the 6.6 release cycle.

CC: @ellatrix @vcanales

MaggieCabrera commented 1 month ago

Pattern shuffling seems like a whimsical fun idea, and WP could always use a bit of those. It reminds me of the color palette randomizer. I'm not sure if it is still in the codebase and under Experiments? Perhaps shuffling and color randomizer could get a proposal for a separate plugin: Randomizer Experiments plugin or something? 🤔

It is still an experiment

fabiankaegy commented 1 month ago

@MaggieCabrera i was under the impression it is included in WordPress 6.6? Is that incorrect?

MaggieCabrera commented 1 month ago

@MaggieCabrera i was under the impression it is included in WordPress 6.6? Is that incorrect?

I mean the color randomizer

vcanales commented 1 month ago

I'm not sure if it is still in the codebase and under Experiments?

The Color Randomizer is still there as an experiment.

Perhaps shuffling and color randomizer could get a proposal for a separate plugin: Randomizer Experiments plugin or something? 🤔

I like this thought — Besides Canonical Block Plugins, we could have a Canonical Gutenberg Experiments Plugin :)

annezazu commented 1 month ago

For context, there was some experimentation to keep content as you shuffled but it was technically complex and is something to explore for future releases. Between undo and overall revisions, this isn't fully destructive in that content is totally lost. I don't know the technical details of what it would take to only show the button if a pattern isn't edited but I don't think there's a clear path there.

Can we keep this open for more feedback and see how this goes in the beta period?

jasmussen commented 1 month ago

I'd tend to agree with Anne, across undo and revisions (which are about to get more prominent), this is just another editing tool, and any changes you make you still have to confirm/save after the fact. Perhaps there's a different word than "shuffle" for this, because what it does is not random—maybe "Cycle patterns"?

Longer term, however, I would love to see any pattern transformations carry over information as best possible—paragraph to paragraph, heading to heading, image to image, and that should work for this as well.

These are not strong opinions.