Skip to content

Change header right options buttons to React - #1978

Merged
jamesmisson merged 22 commits into
UniversalViewer:UIfrom
jamesmisson:header-options-buttons
Nov 25, 2026
Merged

jamesmisson merged 22 commits into
UniversalViewer:UIfrom
jamesmisson:header-options-buttons

Conversation

@jamesmisson

@jamesmisson jamesmisson commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Pull request description

This is probably better seen as a continuation of #1972 as it adds some new features to the Button component necessary for when there is more than one as a group:

  • The Button has a "warm up" feature whereby the tooltip appears instantly if the cursor has recently triggered a tooltip (prevents constant fading in and out when hovering over multiple buttons in a row)
  • Button component styling is now handled by a new uv-btn class (using existing btn class was getting messy - ultimately all btn class rules will be removed in favour of uv-btn). This has required the tests for gallery, settings, and paging toggle buttons to be adjusted to target the new class.
  • The parent component for HeaderRightOptions works out which button is the lastButton based on what is configured to appear, and then sets the right tooltip alignment for the one appearing on the far right.
  • The locale toggle and help button have been added to the existing HeaderRightOptions parent component (no SVG icon for the help button as of yet)
  • The paging toggles (1-up/2-up/gallery) are rendered into the HeaderPanel via the more specific PagingHeaderPanel module; I've just made another React root/parent component here and rendered them separately from the HeaderRightOptions (ultimately these will be moved down to the bottom right of the canvas anyway so separate is easier)
  • Added some styling as discussed in the sprint workshop held today: basic button highlight on hover, icon highlight on hover, subtle dropshadow. All buttons have the icon highlight; background highlight is currently header panel buttons only.
  • Background for hovered button and tooltip uses the @gray variable which is WCAG compliant but might need some more attention in the context of theming.

The header right option buttons are configurable and this will influence the tooltips. Use these settings to test:

{
  "modules": {
    "headerPanel": {
      "options": {
        "localeToggleEnabled": true
      }
    },
    "pagingHeaderPanel": {
      "options": {
        "helpEnabled": true,
        "localeToggleEnabled": true
      }
    }
  }
}

Related issues

Sprint issue: #1956

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:

Not tested on non-mobile touch screens.

@vercel

vercel Bot commented Nov 24, 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 Nov 24, 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 Nov 25, 2026 12:00pm 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.

The major functional change I notice here is that the one-up/two-up/gallery buttons in the old code show the state of which one is highlighted, and that no longer seems to be happening here. Is that intentional, or is it planned future work, or is it an actual problem?

Also, see below for one more question.

@jamesmisson

jamesmisson commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks @demiankatz , I intentionally haven't carried the active/inactive state highlighting for the 1-up/2-up buttons as it'll change again soon anyway: they will be moved in #1809 , which should also turn the two buttons into a proper toggle (only the icon for the currently inactive state should appear). As well as the ticket I've made a todo note in PagingHeaderRightOptions.tsx)Β·

@jamesmisson

Copy link
Copy Markdown
Contributor Author

I've got the test for these buttons working now. This has conveniently exposed a quirk of the previous test file: as it used the default Puppeteer browser window size (800 Γ— 600), UV has always been tested only at its smallest desktop metric (720 wide, as in the screenshot here of the test conditions). This was fine for the previous buttons as they were simply invisible at this size, rather than absent, but wasn't working with the new React buttons, which are absent at this size. I've added a line to enlarge the window to a more representative size when the tests are running. This was new to me at least - something to be aware of as we start shifting the layout around!

debug-viewer

@jamesmisson
jamesmisson marked this pull request as ready for review November 25, 2026 12:18

@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, glad to here that the button state is tracked for future work. Also good catch regarding the tests; I suppose we really ought to have a mechanism for running tests at different resolutions, but that's a separate project for another day. I'm happy to approve this so we can move forward from here!

@jamesmisson

Copy link
Copy Markdown
Contributor Author

Great thanks Demian!

@jamesmisson
jamesmisson merged commit 57e6f32 into UniversalViewer:UI Nov 25, 2026
4 of 5 checks passed

This branch was successfully deployed

1 active deployment
Preview – universalviewer β€” 191c89d5 Deployed Nov 25, 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