Browse menu: redesign as a popover with featured destinations#12917
Open
lokesh wants to merge 3 commits into
Open
Browse menu: redesign as a popover with featured destinations#12917lokesh wants to merge 3 commits into
lokesh wants to merge 3 commits into
Conversation
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.
| </a> | ||
| </div> | ||
| <hr class="browse-popover__divider"> | ||
| <ul class="browse-popover__links"> |
There was a problem hiding this comment.
WCAG 1.3.1: <ul> contains direct text content. Wrap in <li>.
<ul> and <ol> must only contain <li>, <script>, or <template> as direct children.
Details
Screen readers announce list structure ('list with 5 items') based on proper markup. Placing non-<li> elements directly inside <ul> or <ol> breaks this structure. Wrap content in <li> elements, or if you need wrapper divs for styling, restructure your CSS to style the <li> elements directly.
for more information, see https://pre-commit.ci
# Conflicts: # static/css/components/header-bar.css
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feature — Redesigns the Browse menu in the top navigation bar.
What changes for the reader
Today, clicking Browse opens a plain, flat list of links. This PR rebuilds it using our new
ol-popovercomponent, and takes the opportunity to give the menu a hierarchy.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
openlibrary/templates/lib/browse_popover.html, which renders the menu using the newol-popoverweb component (openlibrary/components/lit/OlPopover.js) instead of a native<details>dropdown.ol-popoveralready handles positioning, focus trapping, Escape/outside-click close, reduced-motion, and the mobile bottom-tray behavior.nav_head.htmlnow rendersbrowse_popover(desktop + mobile headers) in place of the genericheader_dropdownfor Browse.browseLinksis unchanged and still feeds the hamburger menu, so nothing else is affected.currentColor; all links keep their existingdata-ol-link-trackanalytics labels.static/css/components/header-bar.css(tokens only, within the0,3,0stylelint specificity cap).static/css/ol-components.cssgets a small pre-hydration rule so the popover's content doesn't briefly flash on page load before the web component upgrades.Testing
/subjects,/trending,/explore,/lists,/collections,/k-12,/booktalks,/random).Screenshot
Stakeholders