Allow unlimited taxonomy terms to be selected

Created on 24 June 2024, 5 months ago

Problem/Motivation

We've got a use case where we have a hierarchical vocabulary of about 150-odd terms to apply to a set of resources. These resources can be somewhat generic in scope, so in some cases we can end up applying a lot of terms to a single node. However, since the autocomplete widget can only take up to 1024 chars, there's a hard limit on the terms we can apply.

There are a couple of ways I can think of to alleviate this.

  1. Adjust the autocomplete widget to allow more characters in the field. This is the easiest to apply but merely increasing the limit might cause the problem again in future. A better solution might be to make the maximum number of characters configurable.
  2. Find a way to avoid using the autocomplete widget at all; maybe use a hidden field that the tree widget manipulates. This would probably result in the best admin UX and be the most flexible, but it would be the least friendly to non-Javascript users.

Steps to reproduce

  1. Set up a content type with an Entity Reference Tree taxonomy term reference field
  2. Try adding many taxonomy terms to a node
  3. Keep going until you get more than 1024 characters in the autocomplete field

Proposed resolution

Reiterating above propositions:

  1. Adjust the autocomplete widget to allow more characters in the field. This is the easiest to apply but merely increasing the limit might cause the problem again in future. A better solution might be to make the maximum number of characters configurable.
  2. Find a way to avoid using the autocomplete widget at all; maybe use a hidden field that the tree widget manipulates. This would probably result in the best admin UX and be the most flexible, but it would be the least friendly to non-Javascript users.

I might go with option 1 for the sake of backwards compatibility and time pressure, but option 2 might be worth looking into later.

Remaining tasks

  1. Define patch for proposal 1
  2. Figure out what's necessary for proposal 2 and implement

User interface changes

For scenario 1, more terms would be allowed in the autocomplete field.

For scenario 2, the autocomplete field would not be shown at all. Perhaps a list of all terms selected would be shown.

API changes

None.

Data model changes

None.

Feature request
Status

Active

Version

2.0

Component

Code

Created by

🇦🇺Australia geoffreyr

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024