Problem/Motivation
When searching via the admin toolbar search field, if there are no results, nothing happens and there is no evidence that a search was performed. Without doing another search, it's not possible to tell whether there are no results or if something is not working. It may be nice to have a simple "No results found" message appear for cases where there are no matches.
Steps to reproduce
Do a search for something with no results and see that nothing happens.
Proposed resolution
Include a "No results found" message when no results are found to let the user know that a search was actually performed.
- The message is displayed as a suggestion that is not a link and cannot be selected.
- Screen readers are told there are no results, not one result.
Remaining tasks
- Review and test the merge request.
User interface changes
A "No results found" item is displayed in the search suggestions when no menu link matches.
API changes
None.
Data model changes
None.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | Before MR.png | 97.13 KB | kanchan bhogade |
| #4 | After MR.png | 98.81 KB | kanchan bhogade |
Issue fork admin_toolbar-3532958
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
Comment #3
chrisla commentedI believe my submitted MR adds a usable "no results" option to the search tool that is also not clickable as a link. I am very happy to get feedback or updates to the code submitted.
Comment #4
kanchan bhogade commentedHi
Tested MR 164 on Drupal 11.x
Applied MR successfully...
The "No results found" message when no results are found is displayed.
Attaching screenshot for reference
Comment #6
dydave commentedThe merge request in this issue is now outdated.... given all the changes to the admin_toolbar_search.js in the last 3.6.3 release.
I've started working on the updated MR, but need a bit more time to refine user interactions in the JS....
I'm probably going to have to ask for a bit of help and review from my colleagues more specialized in JS and CSS (Front-end developers), so it's going to take a bit more time ...
Moving back to Active and for the dev branch.... coming back soon to this issue 👌
In any case, any feedback, suggestions, opinions or recommendations for this feature would be greatly appreciated.
Thanks in advance!
Comment #10
dydave commentedThanks a lot @chrisla for the report and the initial merge request, and @kanchan bhogade for testing it! 🙏
As mentioned at #6, MR !164 was outdated after the refactoring of
admin_toolbar_search.js, so I created a new merge request MR !228, with the feature reimplemented on the current code. I'm moving the issue to Needs review: any review, testing and feedback would be greatly appreciated.How it works
AdminToolbarSearchNoResultsTest, covers the message, the click and the keyboard interactions, and the links displaying again for a matching query. It fails without the change.How to test
nonexistent: "No results found" is displayed, not as a link.basic: the links are displayed, without the message, and still work.What we would like feedback on
One known limitation: the extra links of Admin Toolbar Tools are loaded asynchronously the first time the field is focused, so a query typed before they arrive may show the message until the next keystroke. This is not changed in this MR.
Thanks in advance! 🙏
Comment #11
ressaThanks @chrisla and @dydave for creating this feature! It works well, and if I type in text in the search field for a page that does not exists (like "contentt") the text "No results found" is display, which is not clickable.
Comment #13
dydave commentedMerged, thanks!
The Admin Toolbar Search now displays a No results found message when no menu link matches the search:
textContentinstead of an HTML string, and the labels are stored as plain text.--admin-toolbar-search-item-colorfor the color of the suggestions.AdminToolbarSearchNoResultsTest) covering the message, the screen reader announcement, clicking, the keyboard and both search inputs.Thanks to chrisla for the initial merge request and idea, and to kanchan bhogade for testing it!
Known limitation, which could be handled in a follow-up issue: if a search is typed before the extra links of Admin Toolbar Tools have finished loading, the message can be displayed until the next keystroke refreshes the suggestions.
We'll have to keep an eye on this one...