Skip to content

Unify user selection controls across the blocks #45668

@wojtekn

Description

@wojtekn

What problem does this address?

This is a follow-up to #45640 (comment).

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.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions