Skip to content

Book-unavailable banner: dismissal doesn't persist, and wording misleads for non-lendable books #13301

Description

@lokesh

Problem

The "This book is currently unavailable on Open Library…" banner on book pages has two issues:

  1. Dismissal doesn't persist — clicking the X removes the banner, but it reappears on every page load. The <ol-banner> has dismissible but no dismiss-id, so the site-level persistence layer (cookie via /hide_banner) never kicks in.
  2. Misleading wording — the same "currently unavailable" copy is shown for all four lending states (preview_only, checkedout, waitlist, locate). For preview_only/locate the book will never be borrowable on Open Library, so "currently" wrongly implies it may become available soon.

Reproducing the bug

  1. Go to a book page for a non-lendable book, e.g. https://openlibrary.org/books/OL13424114M (Coming up for air)
  2. Dismiss the banner via the X, then reload the page
  • Expected behavior: dismissal persists (at least for a while); wording reflects whether unavailability is temporary
  • Actual behavior: banner returns on every load; "currently unavailable" shown even for permanently non-lendable books

Context

  • Browser (Chrome, Safari, Firefox, etc): all
  • OS (Windows, Mac, etc): all
  • Logged in (Y/N): Y/N
  • Environment (prod, dev, local): prod

Breakdown

Implementation Details (for maintainers)
  • Persistence: add a dismiss-id (e.g. per-edition, short TTL via data-cookie-duration-days) and guard rendering on the cookie in the template. Since the banner reflects live lending state, a short TTL or session-scoped dismissal is probably right — not a permanent one.
  • Wording: branch the copy on lending_state — e.g. "This book isn't available to borrow on Open Library…" for preview_only/locate, keep "currently unavailable" for checkedout/waitlist.

Requirements Checklist

  • Banner dismissal persists across reloads for a reasonable period
  • Copy distinguishes temporarily vs. permanently unavailable books

Related files

  • openlibrary/macros/EditionNavBar.html (banner markup + lending states)
  • openlibrary/components/lit/OlBanner.js (component; owns no persistence)
  • openlibrary/plugins/openlibrary/js/banner/index.js (dismiss-id → cookie glue)

Stakeholders


Instructions for Contributors

  • Please run these commands to ensure your repository is up to date before creating a new branch to work on this issue and each time after pushing code to Github, because the pre-commit bot may add commits to your PRs upstream.

Metadata

Metadata

Assignees

Labels

Lead: @mekarpelesIssues overseen by Mek (Staff: Program Lead) [managed]Metric: RetentionSurface the value we have and give patrons reason(s) to stick aroundNeeds: BreakdownThis big issue needs a checklist or subissues to describe a breakdown of work. [managed]Priority: 2Important, as time permits. [managed]Type: BugSomething isn't working. [managed]

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions