Problem
The "This book is currently unavailable on Open Library…" banner on book pages has two issues:
- 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.
- 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
- Go to a book page for a non-lendable book, e.g. https://openlibrary.org/books/OL13424114M (Coming up for air)
- 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
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.
Problem
The "This book is currently unavailable on Open Library…" banner on book pages has two issues:
<ol-banner>hasdismissiblebut nodismiss-id, so the site-level persistence layer (cookie via/hide_banner) never kicks in.preview_only,checkedout,waitlist,locate). Forpreview_only/locatethe book will never be borrowable on Open Library, so "currently" wrongly implies it may become available soon.Reproducing the bug
Context
Breakdown
Implementation Details (for maintainers)
dismiss-id(e.g. per-edition, short TTL viadata-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.lending_state— e.g. "This book isn't available to borrow on Open Library…" forpreview_only/locate, keep "currently unavailable" forcheckedout/waitlist.Requirements Checklist
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