WordPress / gutenberg

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

DataViews: Allow users to configure which actions are primary #65600

Open oandregal opened 1 week ago

oandregal commented 1 week ago

Related https://github.com/WordPress/gutenberg/issues/57669

What problem does this address?

Third parties can start extending some of our DataViews-based screens, such as the Pages page, via registerEntityAction and unregisterEntityAction.

While desired, this can grow wildly if unchecked: for example, I presume most plugins will want its actions to be primary. I've done a quick test by setting all existing actions as primary to see how the screen scales and this is what I've got:

https://github.com/user-attachments/assets/121dc21e-d500-4228-960c-39eb1721f2b7

What is your proposed solution?

We should look at how to alleviate this UI tension derived from extensibility.

oandregal commented 1 week ago

One option could be limiting the number of primary actions to a certain number (say, 3). This is not a solution, though, because if more actions declare to be primary, how do we decide which ones to display? It's a FIFO queue or a LIFO queue? Whatever we decide, it's going to be problematic because 3rd parties can register/unregister as they want: there's visual instability of primary actions depending on plugins active, etc.

oandregal commented 1 week ago

A more promising path would be letting users to modify the action's primary state.

Actions can still declare they're primary and plugins can mark them as such — so, after activating a plugin users may see new actions available. However, they'd be able to modify that state. This could be similar to how browser's extension work: once installed, you can pin/unpin them to make them visible or not in the browser bar (they're always available via the browser's extension menu).

If we go this route, we'd need to implement user choices persistence https://github.com/WordPress/gutenberg/issues/57669

jameskoster commented 1 week ago

I think your first suggestion could work in the short term, if we feel there's an urgent need to address this. Otherwise I agree that making the 'primary' status of an action part of the config (and user-editable) could be a nice enhancement.

oandregal commented 1 week ago

I think your first suggestion could work in the short term, if we feel there's an urgent need to address this. Otherwise I agree that making the 'primary' status of an action part of the config (and user-editable) could be a nice enhancement.

It doesn't seem urgent because extensibility hasn't yet landed in WordPress core (not part of 6.7 either): 3rd parties are only able to register new actions if the Gutenberg plugin is active.

jameskoster commented 1 week ago

Some additional considerations for the design:

If we make this user-configurable the options would likely need to adapt based on the chosen layout.