- Issue created by @rkoller
- 🇮🇳India dev.drupal.ln
Hi @rkoller
I have created a patch to address the issue mentioned above. This patch enhances the browse token functionality by providing a filter option, allowing users to easily filter and locate specific tokens. Additionally, I am attaching a screenshot for reference. Please review once.
Thank you.
- Assigned to batigolix
- Status changed to Needs review
2 months ago 1:13pm 18 April 2025 - 🇳🇱Netherlands batigolix Utrecht
I moved the patch to a merge request.
I tested this change:
- If you click on a token in the list, it will populate the last field that had focus. With this change, the last field will become the new token filter field. See screenshot
- It needs some styling to make it look a bit smoother (I checked it with Gin) . See screenshot
- I checked how filter field are being used in Views , maybe that pattern can be applied here as well. See screenshot - 🇩🇪Germany rkoller Nürnberg, Germany
Thank you @dev.drupal.ln & @batigolix for picking up and working on the issue, and apologies for the late reply, i am quite behind on going through all the a11y issues across issue queues that received attention recently. :( Todays a11y meeting was a timely and necessary reminder. So I went ahead and have taken a look at MR93 - a few observations:
1) The styling of the filter field needs some work - in general for Claro the design should orient to the Drupal Design System, for Gin I am not aware of any Figma file. Problem with the current state of the MR, the border has a color contrast of 1.2:1 rgb(235, 235, 235)/rgb(255, 255, 255) in Claro and Gin which is not in line with WCAG 2.2 SC1.4.11.
claro
gin
For Claro the border color should be
var(--input-border-color)
and on hovervar(--input--hover-border-color)
, the border should be solid and the sizevar(--input-border-size)
. The filter field in Claro has a height of 48px (the min-height property for that iscalc(((var(--input-padding-vertical) + var(--input-border-size)) * 2) + var(--input-line-height))
).
For Gin the border color should bevar(--gin-border-color-form-element)
and on hovervar(--gin-color-text)
(checked the filter field onadmin/content
for the variable on hover), the border should be solid, the size is 1px, and the corners should be rounded.
The filter field in Gin has a height of 40px (the min-height property hascalc(var(--input-padding-vertical) * 2 + var(--input-line-height))
. There might be more styling details for Claro and Gin to mind, the variables provided for Gin are only for the light mode, they might vary for the dark mode.2) The input field is missing a label (WCAG 2.2 SC 3.3.2)
3) The filter field is missing an outline when being in focus (WCAG 2.2. SC 2.4.7 & SC 1.4.11)
4) If you are entering a term to filter for into the filter field the list underneath is immediately updated accordingly. This would happen to non-sighted users unexpectedly, which is not in line with WCAG 2.2. 3.2.2. In project browser ( 🐛 Improve the accessibility of the search field Active ) we’ve applied the following approach, we’ve added a search button (for the token module the button could be labeled Filter analogous), and the user can either press enter within the filter field or tab to the filter button and then filter. That way the user is in control.
5) If a user wants to clear the input of the filter field they have to use the back space button. If someone assumes pressing the ESC key would clear the field that closes the token dialog instead. It might be worth to consider to again apply the same approach that is used for project browser and currently proposed for the field ui ✨ Add a clear button to the fields ui Active , that way the behavior would become consistent across Core.
6)
If you click on a token in the list, it will populate the last field that had focus. With this change, the last field will become the new token filter field.
this behavior is problematic. That way a keyboard user has no way to accomplish their key task, inserting a token into a field in the background of the token dialog.
7) the hierarchical list becomes hard to read after you have filtered for a string. the treetable is already hard to comprehend in the unfiltered form, but if you enter something into the filter field (for example user), you dont have a top level element as the first element but one that is from the second or third level (the exact level is impossible to assess)
8) Looking at the treeTable problem, that reminds me to the more fundamental question, about how to proceed - there is 📌 Token UI 2.0 Active about Token UI 2.0. It is the question what would be the best approach for the Token UI going forward.
- Should there be a fundamentally different UI and all other issues postponed until a consensus is reached on Token UI 2.0?
- Should there be a fundamentally different UI but until a consensus is reached there should be smaller issues like this one improving the status quo.
- Or should we proceed in the current direction and iterate in small steps with issues like this?
Uncertain what the best approach might be. In regard of the ideation for Token UI 2.0, I’ve suggested in today’s a11y meeting to raise the topic in one of the future weekly UX meeting on friday.