Sort terms and provide a better UI

Created on 12 May 2022, over 2 years ago
Updated 3 May 2023, over 1 year ago

Problem/Motivation

I think the UI for the MergeTerms form can be improved on two ways:

First, one of the most common use case for this module I can think of is merging "similar" terms (alternative spellings, etc) introduced on free-tagging systems by editors.

A real case I'm working on is the acronym EEUU (the spanish for USA): how to we introduce it? E.E.U.U. ? EEUU? EE.UU? EE.UU.? Turns out, the correct one is EE.UU., but editors used all of the before mentioned variants.

In this scenario, sorting alphabetically the terms would be very benefitial as they will be closer.

Moreover, the <select multiple> HTML form element is known for its incredibly bad UX: the user needs to know how to apply multiple selections using ctrl+click and on long lists the scrolling up and down in order to find the terms becomes a nightmare, not to mention the lack of a visual feedback on the already selected terms out of sight.

Proposed resolution

My proposal for a simpler, better UI is to:

1) sort alphabetically the terms
2) use checkboxes instead of select for a simpler UI

On the case of merging three "EEUU"-like terms, this:

... would become this...

✨ Feature request
Status

Needs review

Version

2.0

Component

Code

Created by

πŸ‡ͺπŸ‡ΈSpain idiaz.roncero Madrid

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • I've had a look at this patch (3d38a7d). It works well for me, and it is certainly a welcome improvement.

    I have a few comments. Issue ✨ Use checkbox and radio instead of Select, Provide better user experience Needs review (patch 04821ad) includes the same functionality, and a bit more, and also works well. I've compared the two approaches.

    #3311345 not only sorts terms alphabetically, and provides check boxes on the page for selecting terms to be merged, it also provides check boxes on the following page for selecting the term to be merged into.

    #3311345 also provides hyperlinks to the terms (on both pages), which is handy for checking that you have selected the correct term(s).

    These are both worthwhile benefits which this patch doesn't have.

    This patch updates the form definition (#empty_option to #description), ensuring that the help text gets displayed. #3311345 doesn't do this, and fails to display the help text.

    The help text is not modified by this patch, but I think it should be, because it is misleading. It says "Select two or more terms to merge together". If I am wanting to merge one term into another existing term, then I should only select a single term on this form. The help text should instead say "Select one or more terms to merge". I think that this clarification of the help text can legitimately come within the scope of "provide a better UI".

    This patch introduces the use of Drupal\Core\Render\Element\Checkboxes::getCheckedCheckboxes to determine which boxes have been checked. #3311345 appears to function perfectly well without this. I'm wondering why this extra call was introduced? What are the benefits?

    In summary, I suggest combining (merging!) this issue with #3311345 to obtain the benefits of both.

  • πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

    @dabley: Given you've committed this change should this issue be closed and additional work be done is separate issues?

  • Hi @DamienMcKenna, the changes I committed were in a different branch (3311345-use-checkbox-and). I suggested that those changes could be merged into the branch for this issue (3280163-ui-improvements). I was waiting to hear from other people whether they thought this would be a good idea or not.
    This issue seems to have already made it's way into release 2.0.0-beta4, (while #3311345 has not), so it would probably be better to close 3311345 and mark it as a duplicate of this one.
    (I'm still a beginner in terms of Drupal contributions, so I'm not sure of the best way of doing things.)

Production build 0.71.5 2024