Skip to content

Add ol-select-popover component#12635

Merged
cdrini merged 3 commits into
internetarchive:masterfrom
lokesh:ol-select-popover
May 8, 2026
Merged

Add ol-select-popover component#12635
cdrini merged 3 commits into
internetarchive:masterfrom
lokesh:ol-select-popover

Conversation

@lokesh
Copy link
Copy Markdown
Collaborator

@lokesh lokesh commented May 5, 2026

Big step towards #12015 - reusable language selector

New ol-select-popover composes ol-popover to provide a multi-select list with optional filter input, grouped SELECTED/SUGGESTIONS sections, and a clear-selections footer. Adds a design page entry for it, plus minor ol-popover refinements and border-radius token tweaks.

Note: Follow-up PR will implement it on patron facing pages.

ol-select-popover.mp4

Technical

  • Composes ol-popover for animation, focus trap, mobile tray, and dismissal.
  • Groups items into SELECTED / SUGGESTIONS; group membership is reactive — checked items move up immediately.
  • Filter input renders when items.length > search-threshold (default 8); 0 always shows it, a large value hides it.
  • Default trigger button or custom trigger via slot="trigger".
  • Emits ol-select-popover-change ({ selected, added, removed }) and ol-select-popover-clear.
  • Bumps border-radius tokens: --border-radius-sm 2→3px, --md 4→6px, --lg 8→9px.

Testing

  1. Visit /design#select-popover.
  2. Try the four examples: auto-search list, small list (no search), custom trigger, with chip group.
  3. Verify keyboard nav (Tab, arrows, Escape), filter, clear footer, and the mobile tray (resize <768px).

Stakeholders

@mekarpeles @cdrini

lokesh and others added 3 commits May 5, 2026 16:53
New ol-select-popover composes ol-popover to provide a multi-select list
with optional filter input, grouped SELECTED/SUGGESTIONS sections, and a
clear-selections footer. Adds a design page entry for it, plus minor
ol-popover refinements and border-radius token tweaks.
Adds an EXCLUDE_DIRS path-prefix check to detect_missing_i18n.py so any
template under openlibrary/templates/design/ is auto-skipped, matching the
existing exclusion for design.html. Strips the now-unneeded $_(...)
wrappers from select-popover.html and the matching design.html nav link,
and removes the corresponding entries from messages.pot.
@lokesh lokesh marked this pull request as ready for review May 6, 2026 04:22
@lokesh lokesh requested a review from mekarpeles May 6, 2026 04:23
Copy link
Copy Markdown

@accesslint accesslint Bot left a comment

Choose a reason for hiding this comment

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

Found 1 issue across 1 rule.

Comment thread openlibrary/components/lit/OlSelectPopover.js
Copy link
Copy Markdown
Collaborator

@cdrini cdrini left a comment

Choose a reason for hiding this comment

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

Lgtm! Chatted about some design feedback, but super excited to see this first step! This will be a huge boon for our search UX!

Comment on lines +354 to +359
this.placeholder = 'Filter…';
this.unselectedHeading = '';
this.selectedHeading = 'SELECTED';
this.suggestionsHeading = 'SUGGESTIONS';
this.clearLabel = 'Clear selections';
this.noMatchesLabel = 'No matches';
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.

Note: i18n

Comment on lines +74 to +79
el.items = [
{ value: 'grid', label: 'Grid' },
{ value: 'list', label: 'List' },
{ value: 'compact', label: 'Compact' }
];
})();
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.

Is it possible to pass this in from html directly? Eg from our templetar or jinja html, something like:

@cdrini cdrini merged commit b86f5c8 into internetarchive:master May 8, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants