Skip to content

Fix right-to-left and bottom-to-top layout for continuous manifests - #1994

Merged
demiankatz merged 2 commits into
UniversalViewer:devfrom
kirschbombe:continuous-rtl
Dec 4, 2026
Merged

demiankatz merged 2 commits into
UniversalViewer:devfrom
kirschbombe:continuous-rtl

Conversation

@kirschbombe

@kirschbombe kirschbombe commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Fix right-to-left and bottom-to-top layout for continuous manifests

Manifests with behavior: continuous and viewingDirection: right-to-left show their canvases left-to-right. bottom-to-top is also broken: the canvases don't stack in the right order. This PR fixes both directions.

Example manifest - a Japanese scroll: https://iiif.library.ucla.edu/ark%3A%2F21198%2Fz1n88rtf/manifest

Summary of changes

  • The right-to-left and bottom-to-top loops now run forwards. Each canvas is placed to the left of, or above, the previous one, offset by that canvas's own width or height.
  • The horizontal layout now uses !isRightToLeft(), so continuous manifests with no viewingDirection default to left-to-right.

Contributor checklist

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.

I tested these layouts:

  • Continuous:
    • no direction
    • left-to-right
    • right-to-left
    • top-to-bottom
    • bottom-to-top
  • Paged: left-to-right and right-to-left.
  • Individuals: right-to-left.

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:

Continuous manifests with exactly two canvases still ignore right-to-left and bottom-to-top. That's because getPagePositions() has a separate two-canvas branch, and I didn't want to touch that. Sending two-canvas manifests through the main loop would fix the direction, but it also drops the pageGap spacing that search-result highlighting seems to depend on? I left that alone since I wasn't sure and wanted to avoid another regression.

@vercel

vercel Bot commented Dec 3, 2026

Copy link
Copy Markdown

@kirschbombe 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 3, 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 3, 2026 10:08pm 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, @kirschbombe, this makes sense to me -- see below for one small suggestion.

@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.

Looks good to me now, @kirschbombe -- thanks for this! I'll hold off on merging until others have had a chance to weigh in, but I've put this on the 4.5 milestone and the community board "in testing" column to ensure we don't lose track of it.

@demiankatz

Copy link
Copy Markdown
Contributor

On a side note, I notice that our example manifest list has a "Tests" section containing "Top to Bottom" and "Bottom to Top," but these manifests no longer seem to exist. Are there cookbook recipes for this that we could replace those examples with? (Obviously, we don't have to do that as part of this PR, but this is just a reminder that it might be useful to sort that out).

@demiankatz
demiankatz merged commit a79d48a into UniversalViewer:dev Dec 4, 2026
4 of 5 checks passed
@github-project-automation github-project-automation Bot moved this from In testing to Completed in Universal Viewer Community Board Dec 4, 2026
@kirschbombe

Copy link
Copy Markdown
Contributor Author

@demiankatz -- Here are some test manifests:

I don't know of any bottom-to-top manifests.

This branch was successfully deployed

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

Labels

Projects

Status: Completed

Development

Successfully merging this pull request may close these issues.

3 participants