WordPress / WordPress/pattern-directory

Retain curation and orderby get parameters, when clicking on a category button

Open
#707 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

[Component] Theme
Dominant language
PHP
Stars
134
Forks
46
Avg merge
9h 4m
Merged PRs (30d)
19

Description

Summary

On the WordPress.org Pattern Directory, when you click on a category, the current community/curated and orderby GET parameters are not retained in the URL, causing the selected curation and sorting order to be lost.

Additionally, when performing a search, only the ?s= parameter is used, without including the curation and sorting order filters. The category links should append these parameters, and it's worth considering whether the search functionality should also retain them or not.

Detailed

On the WordPress.org Pattern Directory, there are four different filters available:

Category (e.g., "All", "Featured", "Posts", etc.)
Search (input field for searching patterns)
Curation (toggle between "Community" and "Curated")
Sorting Order (dropdown to select sorting, e.g., "Newest")

Currently, the curation (community/curated) and sorting order (orderby) filters are managed through GET parameters in the URL. However, there are a couple of issues with how these parameters are handled when interacting with the UI:

Category Links:

When a user clicks on a category (e.g., "Featured", "Text", etc.), the link navigates directly to the category page without appending the current community/curated and orderby GET parameters.
Expected Behavior: The category links should retain the current curation and sorting order parameters, appending them to the URL.

Search Functionality:

When a user performs a search, the current community/curated and orderby parameters are not added to the search query. The search query only uses the ?s= parameter.
Expected Behavior: It's debatable whether the curation and sorting order should persist in the search results. However, consistency would suggest these parameters should be preserved unless there's a strong reason not to.

Steps to Reproduce

Navigate to the WordPress.org Pattern Directory.
Apply a specific curation (e.g., "Community") and sorting order (e.g., "Newest").
Click on a category (e.g., "Text") or perform a search.

Expected Outcome

Category Links: The URL should include the current community/curated and orderby parameters along with the category slug.
Search Functionality: The URL should potentially include the community/curated and orderby parameters in addition to the ?s= parameter.

Actual Outcome

Category Links: The community/curated and orderby parameters are not appended, leading to a loss of the selected curation and sorting order.
Search Functionality: The search query also does not retainin the other filters.

Possible Solution

Update the links for categories to include the current community/curated and orderby GET parameters.
Consider whether the search functionality should also retain these parameters and update accordingly.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Pattern Directory flow described in the issue: apply curation and sorting filters, then use a category link and the search form. Trace the category-link and search URL generation entry points, and consider the stated consistency question for search. Done means category URLs retain the active filters and the search behavior is decided and implemented consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.