Problem/Motivation

The Claro design system includes designs for a next-gen autocomplete that improves UX. The new design is using chips instead of a simple textfield used by the current autocomplete implementation.

Proposed resolution

Implement the new Chips design (Tag / Entity reference field style) to create a better user experience for site authors. Styling the same information in a more appealing and self-explanatory way will also help users understand the UI faster and lower the cognitive load.

Complete specifications on Figma: https://www.figma.com/file/OqWgzAluHtsOd5uwm1lubFeH/Drupal-Design-system...

Remaining tasks

  • Plan theme implementation
  • Create a patch
  • Accessibility review

User interface changes

@todo to explain where&when this will change.

Issue fork drupal-3222995

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

lauriii created an issue. See original summary.

larowlan made their first commit to this issue’s fork.

xjm’s picture

Priority: Normal » Major
ckrina’s picture

Assigned: Unassigned » ckrina
Issue tags: +Needs design

Seeing it's major I'll work on the specs and I'll post here the final designs & link to it asap. Work in progress happening here with initial states designed so the initial work can be based on them: https://www.figma.com/file/OqWgzAluHtsOd5uwm1lubFeH/Drupal-Design-system...

ckrina’s picture

Assigned: ckrina » Unassigned
Issue summary: View changes
Issue tags: -Needs design +Needs accessibility review
StatusFileSize
new58.84 KB
new60.17 KB
new32.71 KB
new50.07 KB

I've almost finished the designs with variants for other usages of chips like filters (not that we need now, but it might be useful for future JS UI elements).
There are 2 remaining questions I'd love to hear other people thoughts on:

1. The focus interaction when there's the close icon: I think the focus should mark only the close icon instead of the whole element because it's what it is going to be "actionable. But when the interaction is via keyboard (removing chips via the keyboard), I'm not sure if focusing only the close icon makes sense. Does anybody has any suggestion?

2. Long title referenced entities: to crop or not to crop?

Apart form this, I think the implementation could move on.

saschaeggi’s picture

I think it makes sense to focus on the "remove" function as this is the action to take when focusing the element.

From a design POV I like the idea to crop a long text, but I think we'd then need to have the full title to appear when you hover the item.
For screen readers it shouldn't be a problem if we truncate the text with CSS3's text-overflow: ellipsis;

saschaeggi’s picture

I've made some adjustments to the Design in Figma.

saschaeggi’s picture

StatusFileSize
new94.12 KB

As for the focus on the remove action on the active chip item not having an sufficient contrast we could lighten up the "green ring" by 20% to make it pass. This way we should get a ratio of 3.52:1.
Left: Claro focus green, Right Adjusted Claro focus green (20% brighter)
 Claro focus green, Right Adjusted Claro focus green (20% brighter)

Also the link to the updated component: https://www.figma.com/file/OqWgzAluHtsOd5uwm1lubFeH/Drupal-Design-system...

saschaeggi’s picture

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

ckrina’s picture

Closed #3023298: Tag / entity reference fields style update as a duplicate for this, and removing the Accessibility review tag for now since no approach has been decided yet.

bnjmnm’s picture

StatusFileSize
new5.6 KB

Design suggestion
I'd like to recommend an approach where the chips are not inside the text input. It's not semantically correct to have interactive elements inside an input, and that happens to be where many of my evaluations of autocomplete libraries failed. At some point, Wordpress was doing this, although the current docs suggest that they converted to a chips-in-input approach. I don't have a local Wordpress ATM, but this is an example of what I recall:

Implementation suggestion
It's not clear if when/if Drupal will stop using jQuery UI autocomplete. A pretty nice library was created to replace it #3076171: Provide a new library to replace jQuery UI autocomplete, but there are several obstacles to getting that completed + there's less urgency to make the switch as jQuery UI is again actively maintained.

Despite this uncertainty, it may be possible to implement this in a fairly library-agnostic manner. I could still rely on Autocomplete events, as any library Drupal switches to will likely have equivalent events. If the contents of the event handler avoid the jQuery UI API and stick to standard JS/DOM interaction, then the chips feature could probably tolerate switching to a new Autocomplete library without much fuss. This would require some research to confirm it's possible, but as someone who spent considerable time with jQuery UI Autocomplete's API, this seems feasible.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

ckrina’s picture

larowlan’s picture

There's some JS in the a11y_autocomplete module that may be useful here, it uses chips for multi select and the new Drupal autocomplete library

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

ressa’s picture

Thanks for working on this.

For anyone looking for a production ready solution, the Tagify module works really well, and is experiencing explosive growth, with +800 new installation the last two months.

gxleano’s picture

I've created an issue https://www.drupal.org/project/tagify/issues/3380516#comment-15310408 and I'm currently working on integrating the designed functionality into the Tagify module. Please feel free to share your thoughts and feedback on this proposed feature.

andypost’s picture

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.

quietone’s picture

Status: Active » Postponed

The Claro theme was approved for removal in #3576460: [policy, no patch] Deprecate and remove Claro.

This is Postponed. The status is set according to two policies. The Remove a core extension and move it to a contributed project and the Extensions approved for removal policies.

The deprecation work is in #3576668: [meta] Tasks to deprecate Claro and the removal work in #3584638: [meta] Tasks to remove the Claro theme.

smustgrave’s picture

Project: Drupal core » Claro
Version: main » 3.0.x-dev
Component: Claro theme » Code
Status: Postponed » Active

Claro has moved to contrib