fecgov / fec-cms

The content management system (CMS) for the new Federal Election Commission website.
https://www.fec.gov
Other
96 stars 38 forks source link

Add filter by subjects for MUR and ADR search #6500

Open patphongs opened 4 weeks ago

patphongs commented 4 weeks ago

Summary

What we're after: Two single select dropdown lists of MUR subjects is integrated into the MUR and ADR search features (primary_subject_id and secondary_subject_id). The list of subjects is hardcoded in the CMS based on this subjects list mapping. (This is like audit search)

The filter applies the condition primary_subject_id to refine search results and adds secondary_subject_id if it applies. The secondary dependency will also be built into the front end subjects list.

Design

Image

Related issues

Completion criteria

johnnyporkchops commented 1 week ago

@JonellaCulmer , @patphongs In the design mockup above, it looks like, when a primary_subject that has a secondary dropdown is chosen, it defaults to the first secondary_subject option ( "Candidates" in the example). Should we consider a scenario where the user does not want to choose a secondary option ... so that would instead default to "More" or "All" for the first secondary dropdown item.

You get more results if you remove the secondary_subject_id id and it searches all secondary_subject_ids: https://api.open.fec.gov/v1/legal/search/?type=murs&api_key=DEMO_KEY&primary_subject_id=3&secondary_subject_id=13 https://api.open.fec.gov/v1/legal/search/?type=murs&api_key=DEMO_KEY&primary_subject_id=3&secondary_subject_id=

JonellaCulmer commented 4 days ago

@johnnyporkchops No objections if an All or More can be supported by the data. I don't think More is a choice though in our dropdowns, but All would be?

johnnyporkchops commented 4 days ago

@JonellaCulmer "More" is the default "choice" for the primary subject dropdown,(and other single selects) which, on these two legal pages (MURS and ADRs) just means it does not filter on subjects or in other words, includes all.

JonellaCulmer commented 4 days ago

@johnnyporkchops Thanks for clarifying. I appreciate it.

johnnyporkchops commented 4 days ago

@JonellaCulmer . I can use "All" for now because thats how we present the two dropdowns for audit search. It is also more semantically evident for screen readers.

After looking through the site's single-select dropdowns, I noticed that we use "More" (receipts) , "Any"(AOs) and "All" (audit search). Maybe we would want to consider making this uniform? We can also put aria-labels on them to clarify that any of those terms mean it is searching all (or not filtering by that parameter) Just to clarify, what is passed to the API for legal searches for any of those scenarios is "", essentially meaning no-value.