WordPress / gutenberg

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

Paragraph block can't be transform into Quote block #44452

Closed fluiddot closed 1 year ago

fluiddot commented 2 years ago

Description

The Paragraph block in the web version can be transformed into a Quote block, however, this option is not available in the native version.

Step-by-step reproduction instructions

  1. Add a Paragraph block.
  2. Type some text.
  3. Tap on the "..." button to open the block settings.
  4. Tap on "Transform block..." option.
  5. Observe that the option for Quote is not displayed.

Expected behaviour

The Paragraph block can be transformed into a Quote block.

Actual behaviour

The Paragraph block CAN'T be transformed into a Quote block.

Screenshots or screen recording (optional)

Web version Native version
Screenshot 2022-09-26 at 10 23 06

WordPress information

Device information

fluiddot commented 2 years ago

I debugged this issue and found that was introduced when Quote V2 was introduced, specifically when the transforms logic was updated due to using inner blocks (reference). In Quote V1, we had a from transform for core/paragraph block, now that block is transformed using the wildcard from transform: https://github.com/WordPress/gutenberg/blob/9580611aaa63b80a3ac490c11dfa83db52b923e5/packages/block-library/src/quote/transforms.js#L62-L91

The problem is that when we introduced the block transformation feature in the native version, we explicitly disabled support for wildcard block transform (reference). Nevertheless, it's not clear to me why we decided to do this based on the original PR and issue 🤔.

I tried enabling support for wildcard block transform, by removing this part, and now I can transform the Paragraph block to the Quote block. However, this also enables other transformations like Paragraph block => Group block that were originally disabled. As far as I tested, all transformations work as expected and match the web version's behavior, so I'm wondering what exactly prevented us to enable all transformations ❓.

Following the original issue, I see some comments about not supporting all transformations (comment reference) because some of them could be confusing to the user (e.g. Paragraph block => Columns block). However, I haven't found any technical argument that discouraged enabling all transformations, apart from not including the blocks that are unsupported in the native version. Being this said, maybe this is good timing to enable all missing transformations to users, wdyt?

cc @iamthomasbishop as was involved in the original issue's discussion.

SiobhyB commented 2 years ago

However, I haven't found any technical argument that discouraged enabling all transformations, apart from not including the blocks that are unsupported in the native version. Being this said, maybe this is good timing to enable all missing transformations to users, wdyt?

I agree that enabling the missing transformations seems like a good path, so that we're matched up to the web as closely as possible. I think users would expect the functionality to work the same across platforms.

If we feel that some transforms are illogical or confusing, I think it'd be best to open issues for wider community discussion, rather than diverging in the apps.

fluiddot commented 2 years ago

I agree that enabling the missing transformations seems like a good path, so that we're matched up to the web as closely as possible. I think users would expect the functionality to work the same across platforms.

My only concern about this change is that we'd need to check all transform combinations in case there are any unsupported or lead to errors. Apart from this, I agree that this seems like a good path.

If we feel that some transforms are illogical or confusing, I think it'd be best to open issues for wider community discussion, rather than diverging in the apps.

Good point! I think we haven't reviewed the UX of transforming blocks since the original change was released. But definitely, if we identified some transform confusing we should open the discussion to the Gutenberg community and collect feedback there instead disabling the features in the app 👍 .