Problem/Motivation
Users want to be able to (x) out any filter that is currently affecting their search. Currently, we only allow the filters down below (the radio button filters) to be X'd out/removed in this way. Several people during listening sessions at DrupalCon Prague indicated they wanted to be able to erase their keyword search without having to backspace the input.
Proposed resolution
Add an (x) icon after the keyphrase, at the end of the input (near the magnifying glass), and/or in the filter list. (TBD!)
Remaining tasks
- ✅ File an issue about this project
- ☐ Input from Design/UI/UX person
- ✅ Manual Testing
- ✅ Code Review
- ☐ Accessibility Review
- ❌ Automated tests needed/written?
| Comment | File | Size | Author |
|---|---|---|---|
| #35 | Screenshot 2024-04-24 at 1.01.15 PM.png | 251.44 KB | bernardm28 |
| #9 | padding and pointer.png | 9.25 KB | mpaulo |
| #7 | buttons over text.png | 10.38 KB | mpaulo |
| #5 | Screenshot 2022-09-22 at 5.49.50 PM.png | 22.84 KB | srishtiiee |
Issue fork project_browser-3310884
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 #2
chrisfromredfinComment #5
srishtiiee commentedComment #6
mpauloI see a new .svg was added to the branch, and googling a piece of it, it seems that it has been taken from the Bootstrap project.
Does the author's license allows redistribution of this, without authoring?
Comment #7
mpauloThe clear button seems to respond as a clear button should:
> user types in the search box, the clear button appears;
> user clicks on the clear button, the search box is cleared, the clear button dissapears, and the browse window reloads to the empty search;
> user types in the search box, the clear button appears;
> user deletes the search query, the search button dissapears.
Apart from the possible icon licensing task, there seem to be missing just one little thing. If the query string is too big, the search and clear buttons stays over the text.

Comment #8
fjgarlin commentedAs suggested above, I'd make sure that the typed characters won't reach the "x" nor the search icon, albeit I doubt people will perform such long searches, but it's good to fix it anyway.
Also, as the "x" is clickable, but the pointer doesn't change, it'd be great to make it change, as when you hover over the search icon.
Comment #9
mpauloAdded some padding to the input, and changed the pointer.

Comment #10
ramonvasconcelos commentedI'll review it.
Comment #11
ramonvasconcelos commentedThe changes look pretty good to me.
Just one thing @mpaulo. The MR is not currently mergeable.
Comment #12
mpauloDo we need a new rebase every time a new issue modifies the tracked built files?
Comment #13
fjgarlin commentedCorrect, we do need to do it I'm afraid for this project.
I reviewed the code again and tested it all in gitpod and I'm happy with the changes.
Marking it RTBC.
Comment #14
bnjmnmWhen using a screenreader, the new button is conveyed as just "button". Assistive tech needs to know what this button does.
In the category buttons below, the remove buttons do this properly, so the same approach should be fine here.
Comment #15
mpauloI gave the image an alt text, and described the button with an aria-label
aria-label="Clear search".Although I'm not sure if there is a better way to do this (e.g. using the .visually-hidden class), this looks just as other buttons on the page.
Comment #16
fjgarlin commentedI know it's a bit tricky sometimes, but you should wait until the tests come green before marking it as "Need review". Otherwise it might take longer for people to review it.
It seems like you need to run one of the prettier commands.
Having said that, the tests will come red until #3312537: Tests started failing in MR is fixed, but at least it'll be a different error.
Comment #17
mpauloSorry about that. Makes sense!
Comment #18
mpauloComment #19
fjgarlin commentedTested it again on drupalpod and it works as expected. Code also looks good (thanks for all the rebuildings and addressing the feedback!).
I'd mark it as RTBC but I'd like @bnjmnm to give the thumbs up to make sure we are doing everything needed for screen readers, etc.
Comment #20
Manoj Raj.R commentedThis should be good context to make this module great in looking.
Comment #21
tim.plunkettComment #22
chrisfromredfinI re-tested this but there's an issue that on hover there's a smaller blue X that needs to be removed. Otherwise, I think this looks good.
I can also confirm that this will close https://www.drupal.org/project/project_browser/issues/3348761 once the blue X is gone.
Comment #24
omkar-pd commentedRemoved default search (x) icon. PR still needs a rebase.
Comment #25
chrisfromredfinComment #27
ahsannazir commentedThe cs spell is failing due to cross.svg saying Forbidden word (grey)
Comment #28
fjgarlin commentedYou can just add the word to the dictionary: https://git.drupalcode.org/issue/project_browser-3310884/-/blob/3310884-...
Or give a pantone value for the color instead.
Comment #31
jayhuskinsComment #33
chrisfromredfinLove this, it's working!
But, I think we need to have a FunctionalJavascript test - approach is probably something like:
1. grab the number of results
2. search for something known (or awful), see that the number of results is correct (or zero)
3. hit the X, make sure the number of results returns to the original value from 1
Comment #34
chrisfromredfinThis needed a rebase for my test to work - the markup hadn't included the issue to change markup classnames. This is a rebase plus the test. Need someone besides me to review my test!
Comment #35
bernardm28 commentedI created a new DrupalPod instance with Drupal 10.1 and the standard profile.
After adding text to the input field I was able to verify that #9 is not an issue anymore. As overlapping text still allows one to click the X and it works as expected by clearing the search results.
The test seems to work as expected checking whether there are results before searching for a string that has no results and comparing their outcome.
Comment #36
bernardm28 commentedComment #38
chrisfromredfinanother one bites the dust! Thanks, everyone. :)