Skip to content

Change header right options buttons to React - #1978

Draft
jamesmisson wants to merge 20 commits into
UniversalViewer:UIfrom
jamesmisson:header-options-buttons
Draft

jamesmisson wants to merge 20 commits into
UniversalViewer:UIfrom
jamesmisson:header-options-buttons

Conversation

@jamesmisson

@jamesmisson jamesmisson commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Pull request description

In draft for now: the existing tests aren't happy with the React buttons.

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 24, 2026 6:17pm 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.

Comment on lines -6 to -8
// title and aria-label need to be omitted from the native props:
// we're passing the content label for the aria-label instead,
// and omitting title so the button doesn't create the native browser tooltip.

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.

Is this comment being intentionally removed, or did it just get lost by accident? It still seems relevant.

This branch was successfully deployed

1 active deployment
Preview – universalviewer — 9df9b8d7 Deployed Nov 24, 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