Skip to content

Paging component - #1995

Open
jamesmisson wants to merge 11 commits into
UniversalViewer:UIfrom
jamesmisson:paging-component
Open

jamesmisson wants to merge 11 commits into
UniversalViewer:UIfrom
jamesmisson:paging-component

Conversation

@jamesmisson

@jamesmisson jamesmisson commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Pull request description

Summary of changes

This changes the paging buttons into a React component, PagingControls, following the pattern and style of ImageControls, using the new Button component. Now that styling is shared between PagingControls and ImageControls, I've added a mix-in .overlay-controls().

This was also an opportunity to simplify the right-to-left/up-down direction logic.

This PR just does the basic React conversion and puts it at the bottom of the canvas - the canvas selection popover will come in a following PR.

I've changed the height of the header in this PR, which messes with the spacing of the PDF extension, which doesn't have equivalent React components to PagingControls and ImageControls yet. I'll need to come back to the PDF extension and apply all the same changes we've made to the OSD extension.

Related issues

#1955

Contributor checklist

Accessibility & internationalisation

  • Accessibility: Changes have been checked against WCAG 2.2 Level AA, with no known accessibility failures introduced.
  • Keyboard accessibility: All new or modified interactive elements can be operated using a keyboard, with appropriate focus management and visible focus indicators.
  • Internationalisation: Contextual language switching works correctly and all new or modified interface strings have translations available in English, Welsh, Polish, French and Swedish.

Compatibility & interoperability

  • IIIF compatibility: Changes have been tested against relevant IIIF Presentation and Image API resources, with no known regressions in supported functionality.
  • Extension compatibility: Changes have been checked for compatibility with existing Universal Viewer extensions and extension points.
  • Backwards compatibility: Changes do not unintentionally break existing public APIs, integrations or configuration options.
  • Browser & device compatibility: Changes have been tested across relevant supported browsers, devices and screen sizes, including responsive layouts.

Code quality & testing

  • Automated testing: Relevant automated tests have been added or updated, and existing applicable tests pass.
  • Regression testing: Existing functionality affected by the changes has been tested to ensure no unintended regressions.
  • Code quality: Changes follow the project's coding conventions, and relevant linting, formatting and type checks pass.
  • Performance: Changes have been reviewed for potential performance impacts, with no known significant regressions.
  • Security: Changes have been checked for potential security vulnerabilities, including unsafe handling of external data, URLs and user input.

Configuration & documentation

  • Configuration: New or modified configuration options have been added to the appropriate configuration files and documented in 'manual/CONFIG.md`.
  • Documentation: The repository README and any other affected documentation have been reviewed and updated where necessary.
  • User experience: Changes have been reviewed for usability, consistency with existing interface patterns and clarity of user interactions.

Additional notes for reviewers:

@vercel

vercel Bot commented Dec 4, 2026

Copy link
Copy Markdown

@jamesmisson is attempting to deploy a commit to the Universal Viewer Team on Vercel.

A member of the Team first needs to authorize it.

@vercel

vercel Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
universalviewer Ready Ready Preview Dec 4, 2026 1:55pm UTC

Request Review

@demiankatz demiankatz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks, @jamesmisson, this works as expected for me (though I didn't take the time to test all the edge cases like right-to-left or different pagination modes), and the code seems much cleaner than before. I have a couple of questions below, but they don't necessarily require action -- I'm just curious.

Comment thread __tests__/image_tests.js
expect(isPrevDisabledInitially).toBe(true);

await page.click(".btn.imageBtn.next");
await page.$eval(".uv-btn.pagingControlButton.next", (el) => el.click());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just out of curiosity, why is a regular click call insufficient here?

PreviousPage,
} from "../uv-shared-module/Icons";

export type PagingDirection = "first" | "prev" | "next" | "last";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't really object to using strings here, but would an enum be more appropriate?

This branch was successfully deployed

1 active deployment
Preview – universalviewer — 2a487df4 Deployed Dec 4, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants