Skip to content

feat: Pagination web component#11811

Merged
cdrini merged 17 commits intointernetarchive:masterfrom
lokesh:feat/web-component-pagination
Feb 13, 2026
Merged

feat: Pagination web component#11811
cdrini merged 17 commits intointernetarchive:masterfrom
lokesh:feat/web-component-pagination

Conversation

@lokesh
Copy link
Collaborator

@lokesh lokesh commented Feb 4, 2026

  • Adds <ol-pagination> web component
  • Updates Design Pattern Library documentation page (see existing) to showcase web components

Note: This PR does not replace any usages of the existing pagination UI. That will be a follow-up.

Related issues:

Technical

Introduces new Lit web component with the following features:

  • Dual navigation modes: URL-based (renders SEO-friendly anchor tags) and event-based (fires update:page event). Currently we are only using URL-based pagination as far as I can tell.
  • A11y - Adds ARIA attributes and semantic landmark which were previously missing.
  • Keyboard support - Adds arrow key plus home/end keyboard support as this is a composite component. Missing in current implementation.
  • Mobile rendering - More compact listing fixes the wrapping on mobile.
  • Reusability - Makes this a business-logic free UI component, no tight coupling with $changequery.

Restructures design.html with interactive examples for component (event-based, URL-based, edge cases) and component (height-based, line-based, custom button text, background colors, small labels)

Testing

Visit URL /developers/design to see the new pagination component.

Screenshot

Existing pagination on the left, new on the right:
image

Old /developers/design on the left, and new on the right:
Frame 427318914

Stakeholders

@RayBB @mekarpeles @cdrini @jimchamp

lokesh and others added 11 commits December 23, 2025 16:03
…e and package.json; update package-lock.json to include lit dependencies.
…; include script for lit-components in footer
…nation display and enhance design documentation with examples.
Resolved conflicts:
- Makefile: use upstream's vite-lit.config.mjs naming
- lit/index.js: keep both OlPagination and OLReadMore components
- footer.html: use upstream's script attribute ordering
- package.json: use upstream's vite-lit.config.mjs naming
- page-design.less: combine index.less import with upstream's typography styles
…l; update styles in page-design.less for improved clarity and presentation. Added event handling for page selection and refined example structure for better user experience.
…ng for improved clarity and user experience. Updated pagination and colors sections with better organization and additional examples. Introduced new styles for design pattern headers and examples.
…eaning up HTML structure for improved maintainability and clarity.
…ing the build process and eliminating legacy support code.
…i18n support for button text and add a new example for height-based truncation.
…syntax, and update design.html examples to improve styling and consistency for the ol-read-more component.
// Import components to register them as custom elements
import './OLReadMore.js';
// Export components (importing also registers them as custom elements)
export { OLReadMore } from './OLReadMore.js';
Copy link
Collaborator Author

@lokesh lokesh Feb 4, 2026

Choose a reason for hiding this comment

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

This code change does not impact the existing implementation of ol-read-more, but switching to doing an export makes future testing, tree-shaking, and other programmatic tasks easier.

lokesh and others added 2 commits February 4, 2026 10:10
…unctions for the ol-colors, ol-pagination, and ol-read-more components. This improves localization capabilities and consistency across examples.
@lokesh lokesh added the Theme: Design Issues related to UI design, branding, etc. [managed] label Feb 4, 2026
lokesh and others added 4 commits February 4, 2026 14:13
…ml to streamline content and improve clarity.
…er width, and focus outline, enhancing consistency and maintainability.
…ly, border width, and focus outline, enhancing consistency and maintainability."

This reverts commit dec1d12.
Copy link
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! Some non-blocking feedback.

Also design feedback: The contrast of the border around the selected page isn't discernible for me.

Not testing, since it's only used on the test page.

Comment on lines +48 to +52
labelPreviousPage: { type: String, attribute: 'label-previous-page' },
labelNextPage: { type: String, attribute: 'label-next-page' },
labelGoToPage: { type: String, attribute: 'label-go-to-page' },
labelCurrentPage: { type: String, attribute: 'label-current-page' },
labelPagination: { type: String, attribute: 'label-pagination' },
Copy link
Collaborator

@cdrini cdrini Feb 13, 2026

Choose a reason for hiding this comment

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

I wonder if we might want to come up with a lit-native i18n approach; this seems like it won't scale for most medium-complexity components. If there's a lit-way that would be great!

* Handle keyboard navigation within the pagination
* @param {KeyboardEvent} e
*/
_handleKeyDown(e) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Niiiice! Love the a11y improvements! This keyboard handling is very common, it would be to have a reusable thing for so that it can be easy for developers who aren't as familiar with a11y that's easy to toss in. Not a blocker.

@cdrini cdrini merged commit acc7f38 into internetarchive:master Feb 13, 2026
5 checks passed
bhardwajparth51 added a commit to bhardwajparth51/openlibrary that referenced this pull request Feb 17, 2026
* Enhance build process by adding support for lit-components in Makefile and package.json; update package-lock.json to include lit dependencies.

* Add pagination component export and integrate it into the Pager macro; include script for lit-components in footer

* Refactor design patterns in HTML and CSS; update Pager macro for pagination display and enhance design documentation with examples.

* Enhance pagination component documentation and examples in design.html; update styles in page-design.less for improved clarity and presentation. Added event handling for page selection and refined example structure for better user experience.

* Refactor design patterns in HTML and CSS; enhance structure and styling for improved clarity and user experience. Updated pagination and colors sections with better organization and additional examples. Introduced new styles for design pattern headers and examples.

* Refactor Pager macro by removing redundant pagination examples and cleaning up HTML structure for improved maintainability and clarity.

* Remove obsolete Vite configuration file for Lit components, streamlining the build process and eliminating legacy support code.

* Update design.html to enhance 'ol-read-more' component examples with i18n support for button text and add a new example for height-based truncation.

* Refactor OLReadMore component registration in index.js to use export syntax, and update design.html examples to improve styling and consistency for the ol-read-more component.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Enhance i18n support in design.html by wrapping text in translation functions for the ol-colors, ol-pagination, and ol-read-more components. This improves localization capabilities and consistency across examples.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Remove redundant description for the ol-colors component in design.html to streamline content and improve clarity.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update OlPagination styles to use CSS variables for font family, border width, and focus outline, enhancing consistency and maintainability.

* Revert "Update OlPagination styles to use CSS variables for font family, border width, and focus outline, enhancing consistency and maintainability."

This reverts commit dec1d12.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
@RayBB RayBB removed the On Testing label Feb 18, 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