Skip to content

Browse menu: redesign as a popover with featured destinations - #12917

Merged
lokesh merged 6 commits into
internetarchive:masterfrom
lokesh:browser-popover
Jul 1, 2026
Merged

Browse menu: redesign as a popover with featured destinations#12917
lokesh merged 6 commits into
internetarchive:masterfrom
lokesh:browser-popover

Conversation

@lokesh

@lokesh lokesh commented Jun 13, 2026

Copy link
Copy Markdown
Collaborator

feature — Redesigns the Browse menu in the top navigation bar.

image

What changes for the reader

Today, clicking Browse opens a plain, flat list of links. This PR rebuilds it using our new ol-popover component, and takes the opportunity to give the menu a hierarchy.

  • A small set of destinations — Subjects, Trending, Library Explorer, and Lists — are featured at the top, each with an icon and a one-line description of what you'll find there. These are the areas we want to guide people toward — the ones we've invested in and want to highlight.
  • The remaining options (Collections, K-12 Student Library, Book Talks, Random Book) sit below a divider as simple links. Sections that are more niche, stale, or inactive stay fully accessible, just downplayed.

The point of the hierarchy is focus: rather than presenting everything as equal, the menu draws attention to a few places worth exploring, while keeping the rest within reach. The menu opens centered under the Browse button with a smooth animation, and on phones it slides up as a bottom sheet you can swipe away.

Technical

  • Adds openlibrary/templates/lib/browse_popover.html, which renders the menu using the new ol-popover web component (openlibrary/components/lit/OlPopover.js) instead of a native <details> dropdown. ol-popover already handles positioning, focus trapping, Escape/outside-click close, reduced-motion, and the mobile bottom-tray behavior.
  • nav_head.html now renders browse_popover (desktop + mobile headers) in place of the generic header_dropdown for Browse. browseLinks is unchanged and still feeds the hamburger menu, so nothing else is affected.
  • Featured-item icons are inline SVGs using currentColor. Analytics: links keep their data-ol-link-track labels, now carrying a 1-based position rank (featured 1–4, simple links 5–8) so we can see how far down patrons reach; a per-open event fires on ol-popover-open (pointer + keyboard), scoped to the browse popover rather than a global listener; and the desktop popover vs. mobile tray are distinguished by track prefix (MainNav / MainNavMobile).
  • Styling lives in static/css/components/header-bar.css (tokens only, within the 0,3,0 stylelint specificity cap). The mobile tray fills the full viewport width; the trigger has a roomier click target and an inline stroked chevron that rotates on open.
  • static/css/ol-components.css gets a small pre-hydration rule so the popover's content doesn't briefly flash on page load before the web component upgrades.

Testing

  1. Load any page and click Browse in the header.
  2. Confirm the featured column (Subjects / Trending / Library Explorer / Lists with icons + descriptions), the divider, and the simple links below.
  3. Each item navigates to the same destination as before (/subjects, /trending, /explore, /lists, /collections, /k-12, /booktalks, /random).
  4. Press Esc or click outside to close; check keyboard tabbing stays within the menu.
  5. On a narrow viewport, confirm it opens as a full-width bottom sheet that can be swiped down to dismiss.
  6. Reload a few times — the menu content should not flash before the page settles.

Screenshot

Stakeholders

Replace the Browse dropdown with the ol-popover web component. The menu
now leads with four featured destinations — Subjects, Trending, Library
Explorer, and Lists — each shown with an icon and a short description, so
it's clearer at a glance where each link goes. The remaining items
(Collections, K-12 Student Library, Book Talks, Random Book) follow below
a divider as simple links.

Also adds a pre-hydration rule so the popover content no longer flashes
on page load before the component upgrades.

@accesslint accesslint Bot left a comment

Copy link
Copy Markdown

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/templates/lib/browse_popover.html
@lokesh
lokesh marked this pull request as ready for review June 15, 2026 20:25
# Conflicts:
#	static/css/components/header-bar.css

@cdrini cdrini 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.

Nice looking great! Love the composability of the new components for stuff like this 🎉

A few points for discussion, but no blockers. Merge at your discretion!

Product feedback: I like that we're trying to create some hierarchy on what is otherwise a very long list :P But The grouping feels a bit arbitrary. Nothing actionable, just a note. I checked matomo to see what was most clicked to see if that elucidated anything, but not really :P Something we should think about in the future.

Event Action Events
MyBooks 757
Subjects 161
Trending 100
RandomBook 76
AdvancedSearch 63
Explore 57
Lists 41
Collections 40
K12Library 36
BookTalks 11

UX Feedback:

  • On mobile it's not full-width in the popover
Image
  • The hover effect effect colour clashes with the colour under the icon, and the line becomes a bit low contrast:
Image
  • The arrow on "Browse" is off center:
Image
  • The click region for "Browse" has become very small ; could use some padding
Image

A11y Feedback:

When I open with the keyboard, it focuses on the entire menu instead of the first option? And if I then hit "tab", it goes to the last option.

<div class="browse-popover__featured">
<a class="browse-feature" href="/subjects" data-ol-link-track="$(pfx)|Subjects">
<span class="browse-feature__icon" aria-hidden="true">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">

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.

Excited for #12955 !

lokesh added 2 commits June 24, 2026 23:55
Follow-up to the popover redesign, resolving @cdrini's review:

UX
- Mobile: let the panel fill the full-width bottom tray (<=767px) instead
  of staying pinned to the 240px desktop width.
- Hover: deepen the icon tile to --beige on row hover so it stays distinct
  from the --lightest-grey row fill (fixes the low-contrast clash); also
  lighten --beige-three so the trigger hover reads.
- Trigger: roomier click target (inset padding + negative margin to keep
  nav alignment), inline stroked chevron that rotates on open, centered via
  align-items on the nav components.

Analytics
- Open tracking on the popover's ol-popover-open event (pointer + keyboard),
  scoped to the browse popover rather than a global listener.
- Surface dimension: distinct track_prefix for the mobile tray
  (MainNavMobile) vs. desktop (MainNav).
- Position: each destination's 1-based rank in the event label.

The keyboard focus-order a11y note is tracked separately and not addressed here.
@lokesh

lokesh commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator Author
  • On mobile it's not full-width in the popover
  • The hover effect effect colour clashes with the colour under the icon, and the line becomes a bit low contrast:

FIXED
image

  • The arrow on "Browse" is off center:
  • The click region for "Browse" has become very small ; could use some padding

FIXED
image

  • When I open with the keyboard, it focuses on the entire menu instead of the first option? And if I then hit "tab", it goes to the last option.

This will be resolved in a separate PR that beefs up our focus state behavior in our web components. #12931

@lokesh
lokesh merged commit 7d0e6d8 into internetarchive:master Jul 1, 2026
4 of 5 checks passed
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.

2 participants