Skip to content

Feat/filter list display#686

Open
kevinmdd wants to merge 6 commits into
masterfrom
feat/filter-list-display
Open

Feat/filter list display#686
kevinmdd wants to merge 6 commits into
masterfrom
feat/filter-list-display

Conversation

@kevinmdd

Copy link
Copy Markdown

Fixes #671

Summary: Replaced dropdown/button displays for enum filters with a new Filter List display mode that shows options as a compact vertical list, showing the first 4 with an "Expand All" toggle when there are 5 or more.

  • User experience
    • Enum filters (Language Authority, Modality, Languoid Type, Territory Type, ISO Language Status) now show as a vertical plain-text list instead of a dropdown or button group
    • Options are visible at a glance without needing to open a dropdown
    • Increased font bold size and spacing between labels for better visibility
    • "Expand All" / "Collapse" button appears when there are more than 4 options
  • Logical changes
    • Added FilterList to the SelectorDisplay enum
    • Selector now slices visible options to the first 4 when in FilterList mode and not expanded
    • FilterListMoreButton component added to Selector for the expand/collapse toggle
    • SelectorContainer renders as flex-column with full width for FilterList
    • useClickOutside guarded to not collapse FilterList state on outside click
  • Data
    • No data changes
  • Refactors
    • LanguageModalitySelector, LanguageScopeSelector, TerritoryScopeSelector, VitalitySelector updated to accept and forward a display prop
    • VitalitySelector.test updated to include FilterList in the SelectorDisplay mock and added "Expand All" click before checking all options are visible
    • Continued Refactors for: selectorbuttons, filterlist, and selectoroptions in controls.css

Out of scope/Future work: The dual meaning of expanded state (dropdown open vs filter list expanded) could be split into two separate state variables for clarity.

Test Plan and Screenshots

How to test the changes in this PR: Run npm run dev, open the Filter panel, then verify enum filters show as vertical lists and "Expand All" works.

Before After
before after

Checklist

Feel free to check off or just delete items in this section as you have completed them.

Summary

  • Clear description of what and why
  • Scope kept focused; note follow-ups if any
  • Set yourself as assignee
  • Mention the issue (usually by writing "Fixes #ISSUE_NUMBER" or "Closes #ISSUE_NUMBER")

Testing

  • npm run lint
  • npm run build
  • npm run test
  • Tests added or updated for changed logic
  • npm run dev -- tried out the website directly
  • Include screenshots as noted below
  • Write comments on manual testing

Changes

Visual changes

  • Add screenshots to the table template at the top of this file. You can include images inside the table
  • Drag and drop images in the GitHub PR comment box to upload screenshots
  • Since more views can be reproduced by just sharing the URL -- add links (eg. link) to the relevant page and/or conditions to reproduce the view.

Data changes

  • TSV, SVG, etc. edits in public/data/
  • Corresponding readmes updated in public/data/
  • Load/connect/compute updates in src/features/data/ including how we aggregate data or compute derived values

Internal changes

  • Logical changes
  • Refactors, moving files around
  • If you notice any changes that require explanations, make sure to include the explanations in the code as well.

Docs

  • Code is self-documenting, or if not, comments are added where needed.
  • Updated markdown readme files documenting how the code behaves or how to develop in case there are any relevant changes to make.

@kevinmdd kevinmdd requested a review from a team as a code owner June 25, 2026 03:44
@kevinmdd kevinmdd self-assigned this Jun 25, 2026
@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Cloudflare Pages preview

kevinmdd added 2 commits June 24, 2026 20:45
…tion-Commons/lang-nav into feat/filter-list-display

# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.

@conradarcturus conradarcturus left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! Looking really good. I'm glad the strange errors resolved with the new base. There are just some minor edits so I'll approve it so you can edit it and merge the code after you're ready rather than waiting for another review.

Also, you see the screenshot tests are failing -- after you make your updates add a tag to your PR update-baselines and it will update the screenshot tests with the new screenshots.

// For FilterList: collapse to first N items unless expanded
const isFilterList = display === SelectorDisplay.FilterList;
const filterListCollapsed =
isFilterList && !expanded && options.length > FILTER_LIST_INITIAL_COUNT;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When there are 5 options, showing the first 4 and keeping the 5th hidden under this is a funny restriction, so let's only collapse the list when there are more than 5 options.

Funny thing, 3 of the 4 enum lists have 5 elements >_< in the future that won't always be the case! but yea it's funny today.

Suggested change
isFilterList && !expanded && options.length > FILTER_LIST_INITIAL_COUNT;
isFilterList && !expanded && options.length > FILTER_LIST_INITIAL_COUNT. +1;

toggle,
}) => {
const { display } = useSelectorDisplay();
if (display !== SelectorDisplay.FilterList || totalCount <= FILTER_LIST_INITIAL_COUNT)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In line with the prior feedback, allow for 5 items -- only hide them if we're hiding 2 or more.

Suggested change
if (display !== SelectorDisplay.FilterList || totalCount <= FILTER_LIST_INITIAL_COUNT)
if (display !== SelectorDisplay.FilterList || totalCount <= FILTER_LIST_INITIAL_COUNT + 1)

Comment thread src/app/controls.css
Comment on lines +43 to +49
width: fit-content;
border-width: 0.2em;
border-radius: 0.35em;
color: inherit;
cursor: pointer;
font-size: 0.9em;
padding: 0.25em 3.5em;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can let this mostly match the global button default style. I think width and cursor are redundant. I'm not sure about the color -- I do like that it is black, but now it does not respond to the hover styling.

Suggested change
width: fit-content;
border-width: 0.2em;
border-radius: 0.35em;
color: inherit;
cursor: pointer;
font-size: 0.9em;
padding: 0.25em 3.5em;
font-size: 0.9em;
padding: 0.25em 3.5em;

Comment on lines -32 to +39
lineHeight: '1em',
lineHeight: '2.25em', // more spacing for visibility
alignItems: 'center',
fontWeight: 'bold',
fontWeight: '800', // adjusted font weight for easier visibility
padding: '0.5em',
margin: 'auto 0', // Vertically center
whiteSpace: 'nowrap',
borderRadius: '1em',
marginBottom: '-0.5em', // adjusted to have selector buttons closer to their label

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are affecting the selector buttons for other display types (for example, see the view options in the top-right gear menu).

Move the lineHeight and marginBottom styles down to case SelectorDisplay.FilterList:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Filters: Show the nicely formatted buttons for the enum suggestions

2 participants