Skip to content

Use React button component for open/close left/right panel toggle. - #1980

Open
jamesmisson wants to merge 18 commits into
UniversalViewer:UIfrom
jamesmisson:react-panel-buttons
Open

jamesmisson wants to merge 18 commits into
UniversalViewer:UIfrom
jamesmisson:react-panel-buttons

Conversation

@jamesmisson

Copy link
Copy Markdown
Contributor

Pull request description

Summary of changes

This implements the new React button component for the left and right panel toggles: collapseButton, expandButton.

I've used the existing $collapseButton and $expandButton elements as react roots. It's required some rewriting of the css to position the buttons and the vertical text on the closed panels.

The buttons are still rendered by the BaseExpandPanel class, but obviously they need to look/behave different for the left and right panels, so I've used a pattern that sets a method on the base class (defaulting to the left panel), and then overriding this in the right panel class that inherits it. This applies to the new methods getToggleTooltipPlacement, getExpandIcon, and getCollapseIcon.

I've added new icons for the toggles. I've taken the icon we settled on in #1804 and made versions in UV's current brutalist icon style. Keeping the same size, proportions and conventions as the other icons, these come up pretty small, so I'm not totally convinced about them (I tried a few variants - this was the best without breaking the rules of the icon style).

I've noticed that the React buttons take a noticeably longer time to load than the previous buttons - probably to be expected. We should look in to how to manage this without layout shifts on start-up.

Related issues

#1816

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.

  • tested in Chrome and Firefox but not on a tablet.

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 Nov 26, 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 26, 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 26, 2026 6:14pm UTC

Request Review

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

This looks great @jamesmisson. Thank you so much for your work.

@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; due to the holiday I haven't had a chance to do hands-on testing or a really deep review yet, but the code looks pretty good at a glance. See below for one suggestion that immediately sprang to mind, though!

}
}

// overflow: visible is necessary for the tooltip to appear over the top of .rightPanel, unclipped,

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.

Given that left and right panel have a lot of complex styling that requires detailed comments, and given that it seems to be the same for both of them, is it possible we need a side-panel.less that left and right panel both inherit from, so we can centralize the complexity and prevent things from getting out of sync in future?

This branch was successfully deployed

1 active deployment
Preview – universalviewer — 9e66e285 Deployed Nov 26, 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.

3 participants