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

Explore adding media related roles to block attributes #65186

Open
ntsekouras opened this issue Sep 10, 2024 · 1 comment
Open

Explore adding media related roles to block attributes #65186

ntsekouras opened this issue Sep 10, 2024 · 1 comment
Labels
[Feature] Block API API that allows to express the block paradigm. [Feature] Blocks Overall functionality of blocks [Type] Enhancement A suggestion for improvement.

Comments

@ntsekouras
Copy link
Contributor

ntsekouras commented Sep 10, 2024

For a while now we have introduced the __experimentalRole property for block attributes. In spite of its name, the feature is considered stable, since it's been in many WP releases.

It's usage right now is having a content value, that is used in various features like the contentOnly mode and pattern transformations. Recently we expanded its usage by supporting a local value.

This role could be useful for marking some media attributes too, and handle cases where we could easily create previews of media blocks (like Image, Media Text etc..), support more blocks in the post publish panel to upload external images, etc..

In order to make some media blocks more semantic, we'd need more than one role though. For start we'd need the id and the url, which could have different names in blocks. For example the id in Image block is id and in Media Text is mediaId.

We will most certainly need a mediaType role as well. An example would be video and audio have different tag attributes and a preview for them would have to be generated differently. You can see an example of such handling for media tab in inserter.

Finally, right now these attributes have the content role assigned and that could simply mean that the new media roles are also considered content. This would require more testing though in order to validate that this is the case for all blocks that use them.

@ntsekouras ntsekouras added [Type] Enhancement A suggestion for improvement. [Feature] Blocks Overall functionality of blocks labels Sep 10, 2024
@mtias mtias added the [Feature] Block API API that allows to express the block paradigm. label Sep 11, 2024
@mtias
Copy link
Member

mtias commented Sep 11, 2024

Thanks for starting this one—defining a good set of attribute roles is going to be key to normalize a lot of the behaviors that otherwise require very ad hoc handling across blocks. It's the way in which we can scale good user experience across the block ecosystem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Block API API that allows to express the block paradigm. [Feature] Blocks Overall functionality of blocks [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

2 participants