WordPress / gutenberg

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

Unify user selection controls across the blocks #45668

Open wojtekn opened 2 years ago

wojtekn commented 2 years ago

What problem does this address?

This is a follow-up to https://github.com/WordPress/gutenberg/pull/45640#issuecomment-1309204191.

Under that PR, we fixed the issue that limits the number of users displayed in the Post Author block to 10.

After the fix, we display up to 100 users, and if the number of users is higher than 25, we display Combobox instead of Select.

We want to do more refactoring to fix it further and to unify the UX.

What is your proposed solution?

From @noisysocks comment:

So it looks like the PostAuthor component in the @wordpress/editor package handles all of this perfectly which is that it uses a SelectControl if there are fewer than 25 users and a ComboboxControl if there are more than 25 users. When using a ComboboxControl it will perform new REST API fetches as the user types into the text input.

https://github.com/WordPress/gutenberg/blob/trunk/packages/editor/src/components/post-author/index.js

I think the ideal solution is to move this PostAuthor component into the @wordpress/block-editor package (you'll need to ensure backwards compatibility) and then change all of the blocks that have a user dropdown to use this component

In addition to moving the PostAuthorCombobox and PostAuthorSelect components as proposed, we will need to refactor them to make them more generic.

Then we can re-use them in the PostAuthor block and other blocks e.g. Avatar block.

github-actions[bot] commented 1 year ago

Hi, This issue has gone 180 days without any activity. This means it is time for a check-in to make sure it is still relevant. If you are still experiencing this issue with the latest versions, you can help the project by responding to confirm the problem and by providing any updated reproduction steps. Thanks for helping out.

github-actions[bot] commented 1 year ago

Hi, This issue has gone 30 days without any activity. This means it is time for a check-in to make sure it is still relevant. If you are still experiencing this issue with the latest versions, you can help the project by responding to confirm the problem and by providing any updated reproduction steps. Thanks for helping out.

jordesign commented 1 year ago

@noisysocks @wojtekn Just checking through Stale issues - I wanted to check if this is still something that needs consideration?

noisysocks commented 1 year ago

I think it would be a nice code quality improvement but it's not urgent by any measure and happy for a dev to stumble across it naturally rather than it be tracked by an issue.