Block theme: Allowing users to clear the search form and submit.
Describe the bug
We currently submit the page to apply filters and/or reset states. However, the search bar currently includes the required attribute which makes it impossible to clear the search term directly. I think we should remove that attribute which gives users the ability to clear their search term.
I did this for the wp.org/plugins theme and think we should do it here.
Problem
I've added the "All" link which clears the search by bringing you back out to the archives page, in #669.
It doesn't make sense to me to search for an empty string to get back to the full archives, so I think what we've got on Patterns now makes more sense.
I'm not sure it's clear that in order to clear my search while on the "All" category, I need to click on "All" again. Thinking about this use case:
- User arrives on wp.org/patterns
- User search for something in the search bar
How would this user know that they need to click "all" to remove their keyword?
EDIT: I recognize they can move back through the breadcrumbs.
Just noting that we have this issue everywhere we use the Core Search block: Developer Resources, Developer Blog, Showcase, etc. 😅
That said, I think it feels more awkward here due to the categories.
Considering this is a core block, and we would probably want the same behavior everywhere, this should either be addressed in core or in wporg-mu-plugins.
However, it seems to be very intentional that the search form does not submit when empty.
- Original gutenberg issue & PR for updating the block
- The 8yr old core ticket with some wpcom usage metrics
Also, empty-search results don't really work by default (for example, this still uses the search result template). So I don't think this would gain any traction in core.
If we decide the wporg case is different, then this should be moved over to wporg-mu-plugins so it applies across the site.
However, it seems to be very intentional that the search form does not submit when empty.
Yeah, I understand the situation where you have already searched for something and now want to clear your search. The current setup makes this a bit difficult. On the current Plugins site, searching for an empty string takes you back to the homepage, which I don't think would work (or be intuitive) in all search bar implementations across WordPress.org.
Also if you have not already searched, I don't feel like you should be able to search for an empty string.
Yeah, I think we need to rethink applying & clearing filter combos in general (including these other issues #674 & #678).
Yeah, I think we need to rethink applying & clearing filter combos in general (including these other issues https://github.com/WordPress/pattern-directory/issues/674 & https://github.com/WordPress/pattern-directory/issues/678).
💯 A more holistic solution for the whole site and the various use cases for filtering and search would be ideal. cc @fcoveram
One of the main reasons of why the flow looks broken is that we have not defined the initial stage/screen for where users start from.
In other repository services, like YouTube and Pinterest, the homepage works as an index page of curated content, and when you search for something, you land on a similar page that allows you to filter. In both cases, clicking on either the logo or “home” takes you back to the initial stage. Pinterest also does it by clearing the search input, whereas YouTube only clears the text typed.
| Initial stage | Search results page | |
|---|---|---|
| YouTube |
It seems that we need to define that initial stage in Plugins. We could mirror Showcase flow and have two instances, the section name that takes you to the homepage (already implemented), and a new “All plugins” link that takes you to a new view with all patterns displayed (not filtered, and sorted by newest [TBD]). This logic could also work for Patterns, where the “All patterns” link addresses the Curated/Community discussion by showing them all and sorted by newest (TBD).
This idea sounds appealing to me as it reinforces the relationship of Extend group by making the navigation and the IA more consistent, and therefore, not relearning how the section works.
Developers and Forums, on the other hand, are special case as you can consider multiple initial stages. The latter for instance has one search per forum.