Skip to content

[FormTokenField] Close the form when the number of tokens reach maxLength #42773

@dinhtungdu

Description

@dinhtungdu

What problem does this address?

When <FormTokenField/> is used as a dropdown selector, it's natural to collapse the suggestions and hide the input field when a token is selected (like the <select> behavior).

By the way, closing the form is also a good way to inform users that the maximum number of tokens is selected.

What is your proposed solution?

We have two options:

  • Create another prop to control this behavior, something like __experimentalCollapseOnMaxLenghtReach.
  • Or, set this as the default behavior, when maxLength is set. (This may be not realistic because it changes the behavior of the component which many sites are depending on that).

Additional information:

This is suggested by @Aljullu on woocommerce/woocommerce-blocks#6647 (review)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions