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?
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

chrisfromredfin created an issue. See original summary.

chrisfromredfin’s picture

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

srishtiiee’s picture

Status: Active » Needs review
StatusFileSize
new22.84 KB

mpaulo’s picture

I 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?

mpaulo’s picture

StatusFileSize
new10.38 KB

The 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.
Printscreen of the buttons over text problem

fjgarlin’s picture

Status: Needs review » Needs work

As 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.

mpaulo’s picture

Status: Needs work » Needs review
StatusFileSize
new9.25 KB

Added some padding to the input, and changed the pointer.
Padding and pointer are now fixed

ramonvasconcelos’s picture

Assigned: Unassigned » ramonvasconcelos

I'll review it.

ramonvasconcelos’s picture

Assigned: ramonvasconcelos » Unassigned
Status: Needs review » Needs work

The changes look pretty good to me.
Just one thing @mpaulo. The MR is not currently mergeable.

mpaulo’s picture

Status: Needs work » Needs review

Do we need a new rebase every time a new issue modifies the tracked built files?

fjgarlin’s picture

Status: Needs review » Reviewed & tested by the community

Correct, 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.

bnjmnm’s picture

Status: Reviewed & tested by the community » Needs work

When 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.

mpaulo’s picture

Issue summary: View changes
Status: Needs work » Needs review

I 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.

fjgarlin’s picture

Status: Needs review » Needs work

I 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.

[warn] src/Search.svelte
[warn] Code style issues found in the above file(s). Forgot to run Prettier?

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.

mpaulo’s picture

Status: Needs work » Needs review

Sorry about that. Makes sense!

mpaulo’s picture

fjgarlin’s picture

Tested 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.

Manoj Raj.R’s picture

This should be good context to make this module great in looking.

tim.plunkett’s picture

Issue tags: +core-post-mvp
chrisfromredfin’s picture

Status: Needs review » Needs work

I 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.

omkar-pd made their first commit to this issue’s fork.

omkar-pd’s picture

Removed default search (x) icon. PR still needs a rebase.

chrisfromredfin’s picture

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

ahsannazir’s picture

The cs spell is failing due to cross.svg saying Forbidden word (grey)

fjgarlin’s picture

You 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.

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

jayhuskins’s picture

Status: Needs work » Needs review

chrisfromredfin changed the visibility of the branch 3310884-ability-to-clear to hidden.

chrisfromredfin’s picture

Status: Needs review » Needs work

Love 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

chrisfromredfin’s picture

Status: Needs work » Needs review

This 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!

bernardm28’s picture

StatusFileSize
new251.44 KB

image testing this issue

I 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.

bernardm28’s picture

Status: Needs review » Reviewed & tested by the community

chrisfromredfin’s picture

Status: Reviewed & tested by the community » Fixed

another one bites the dust! Thanks, everyone. :)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.