Skip to content

Implement pagination web component on Trending page#12035

Merged
cdrini merged 7 commits intointernetarchive:masterfrom
lokesh:lit-pagination
Mar 20, 2026
Merged

Implement pagination web component on Trending page#12035
cdrini merged 7 commits intointernetarchive:masterfrom
lokesh:lit-pagination

Conversation

@lokesh
Copy link
Copy Markdown
Collaborator

@lokesh lokesh commented Mar 6, 2026

Adds <ol-pagination>, a Lit web component, to the trending page as a first integration.

  • Accessiblerole="navigation", aria-current, per-button labels, keyboard nav (arrows, Home, End). Old macros have none of this.
  • Dual mode — Real <a> tags for SEO by default, plus an ol-pagination-change event for SPA-style use. Old macros only do full-page nav.
  • One component, not four — Self-contained web component with shadow DOM. No CSS conflicts, no template dependencies.
  • Better ellipsis — Shows 1 ... 5 6 7 ... 50 when in the middle. More standard UX.
  • i18n ready — All labels passed as translatable attributes from the server-side macro wrapper.

Changes

  • OlPagination.js — Lit component with a11y, keyboard nav, URL/event modes

  • OlPagination.html — Templetor macro wrapper for server-side usage

  • trending.html — Switched to new component

    Testing

    • /trending/now — pagination renders and navigates correctly
    • No regressions on pages still using old macros

    Screenshot

image image

lokesh and others added 5 commits March 6, 2026 09:56
Rename custom event from update:page to ol-pagination-change with
structured detail object. Add self-update of currentPage with
cancelable support.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Updated the OlPagination component's documentation to clarify the behavior of the baseUrl property and its fallback to the current page URL. Improved examples to demonstrate analytics tracking and the handling of the ol-pagination-change event. Adjusted text for better clarity on navigation options.
Added a new OlPagination component for improved pagination functionality. Updated the trending template to utilize the new component, replacing the previous pager implementation. Enhanced CSS for pagination styling and adjusted mybooks list margin for better layout.
* @prop {String} labelPagination - Aria label for the navigation landmark (default: "Pagination")
*
* @fires update:page - Fired when a page is selected, detail contains the page number
* @fires ol-pagination-change - Fired when a page is selected. detail: { page: Number }
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Updated event name to use web component convention, previously it was using a Vue custom event naming convention.

@lokesh lokesh changed the title Implement pagination component Implement pagination web component on Trending page Mar 6, 2026
@lokesh lokesh marked this pull request as ready for review March 6, 2026 23:26
@lokesh lokesh added the Theme: Design Issues related to UI design, branding, etc. [managed] label Mar 6, 2026
@lokesh lokesh self-assigned this Mar 6, 2026
Resolve conflicts in OlPagination.js (JSDoc comment), design.html
(analytics tracking demo), and messages.pot (i18n string) — keeping
our branch's improved analytics tracking example and preventDefault
behavior.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@lokesh lokesh requested a review from cdrini March 12, 2026 23:05
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! Tested on testing on FF+Win

@cdrini cdrini merged commit fd5f2cd into internetarchive:master Mar 20, 2026
3 of 4 checks passed
@RayBB RayBB removed the On Testing label Mar 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Theme: Design Issues related to UI design, branding, etc. [managed]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants