Skip to content

Library UI cards with logos and descriptions (PP-3116) - #202

Merged
tdilauro merged 1 commit into
mainfrom
feature/library-cards
Sep 28, 2026
Merged

tdilauro merged 1 commit into
mainfrom
feature/library-cards

Conversation

@tdilauro

Copy link
Copy Markdown
Contributor

Description

  • The library lists on the multi-library home page and the item landing page now show each library as a card with logo, title, and a description (limited to two lines).
  • A generic library icon holds the logo spot when a library has no logo or its logo fails to load. The spot is blank while a logo loads.
  • The whole card is clickable. The title link or button remains the only focusable element, and the description is attached to it as its accessible description.
  • Cards have a border and a small shadow, with a larger shadow on hover (except while a card is disabled). Hover transitions respect reduced-motion settings.
  • Logos load lazily.
Screenshot 2026-09-26 at 14 49 57

Known issues:

  • A white logo on a transparent background is invisible on a white card, and thus looks blank.
  • Libraries configured statically in the the configuration file show the default library icon when they have no logoUrl, and no description when they have no description. This is true even when their authentication document has a logo or a description. We do not currently use authentication documents to generate the cards.
Screenshot 2026-09-26 at 14 54 07

Motivation and Context

Logos and descriptions make libraries easier to recognize and tell apart than a list of names alone. The library list already includes a logo and a description whenever the static library config or the registry provides them, but previously nothing displayed them.

[Jira PP-3116]

How Has This Been Tested?

  • Manual testing in local dev environment.
  • New unit tests for the card: logo rendering, the default logo with and without a logo URL, fallback when a logo fails to load, the accessible description, and the footer.
  • Home page and item landing page tests check that each library's logo and description reach its card.
  • All tests pass locally and in CI.

Checklist:

  • I have updated the documentation accordingly.
  • All new and existing tests passed.

@tdilauro
tdilauro requested a review from a team September 26, 2026 19:00
@tdilauro
tdilauro added this pull request to stack #204 September 28, 2026 01:01

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

These look great, @tdilauro. The styling is nice and they're all appropriately accessible.

I have one comment that doesn't need to be addressed in this ticket, but I wanted to mention. As these library lists grow, we should consider virtualizing them, especially now that we're rendering more elements. The performance locally doesn't seem impacted at all -- which is why I don't think we need to address this now -- but I do think performance could be impacted at some point.

@tdilauro
tdilauro merged commit 152a762 into main Sep 28, 2026
7 checks passed
@tdilauro
tdilauro deleted the feature/library-cards branch September 28, 2026 17:59
tdilauro added a commit that referenced this pull request Sep 29, 2026
## Description

Adds basic library pinning, behind a new feature flag.

- **Feature flag:** set the `PALACE_CPW_FEATURE_PINNING` environment
variable to `true` to enable pinning. It is off by default; while off,
pin controls are hidden and stored pins are ignored. The flag is
documented in the README with the other feature flags.
- **Pin and unpin** from a library's page (header, next to the language
selector) and from each card on the multi-library home page. The item
landing page has no pin controls.
- **My Libraries** section above the search on the home page and the
item landing page. It lists pinned libraries in pinned order and leaves
out any that are no longer available.
- **With pins shown:** the search heading becomes "Find another
library:" and the full library list shows only while the search box
holds text. Pinning or unpinning from the home page clears the search.
- **Public computer warning** on the first pin, with a "Do not show this
again." option and a "Reset the shared computer warning" button in My
Libraries.
- **Unpinning a library the user is signed in to** asks for confirmation
and signs out. From the library page this runs the full sign-out flow,
now shared with the Sign Out button through a new `useSignOutFlow` hook.
From the home page it clears the stored credentials only.
- **Accessibility:**
  - Pin and unpin are announced to screen readers.
- When the pressed button disappears, focus moves to the library's new
button, a neighboring library's button, or the heading.
- The dialogs are named and described by their visible heading and
message.
  - The search box is named by its heading.
- **Shared pieces:** an `AlertDialog` component for confirmation
dialogs; `LibraryCard` gains a slot for the pin button.
- **Dialog fix:** dialogs and their backdrop now sit on the theme's
`modal` layer, so page content no longer shows through. This applies to
all dialogs.
- **Translations:** new strings in French, Italian, German, and Spanish,
plus pinning terms in the translation glossary.

Known limitations:
- VoiceOver in Safari can miss the pin and unpin announcements when
focus moves at the same time. VoiceOver-specific support is deferred for
now.
- Unpinning a signed-in library from the home page does not call the
server-side logout.

> [!IMPORTANT]
> This branch is stacked on PR #202. This PR must not be merged until
that one lands.

## Motivation and Context

Patrons should not have to find their library(ies) in the full list on
every visit. Pinning keeps those libraries at the top of the library
pickers on this device. The `PALACE_CPW_FEATURE_PINNING` flag allows us
to test the feature without it surfacing to users before it is ready.

[Jira PP-3116]

## How Has This Been Tested?

- Unit tests cover:
  - the pin button, both dialogs, and the announcements;
- the My Libraries section, including focus after pin and unpin and
changes from another tab;
  - both library pickers, with the hidden list and the search reset;
  - the header pin and both sign-out paths;
  - the feature flag.
- Checked by hand in Chrome and Safari: keyboard focus, dialog behavior,
and the dialog layering.
- All tests pass locally and [in
CI](https://github.com/ThePalaceProject/web-patron/actions/runs/36363276245).

## Checklist:

- [x] I have updated the documentation accordingly.
- [x] All new and existing tests passed.

## Screenshots

Initially the full "Choose a library" and we click the pin icon
<img width="732" height="302" alt="Untitled 11"
src="https://github.com/user-attachments/assets/c32aeeef-af3d-4a48-b597-e161c3e2de07"
/>

Confirm the pin
<img width="844" height="645" alt="Untitled 6"
src="https://github.com/user-attachments/assets/f04d04ae-8482-4974-9aaf-3ce8d7e09071"
/>

Now the library is pinned in "My Libraries"
<img width="737" height="454" alt="Untitled 7"
src="https://github.com/user-attachments/assets/3ef55ce0-dbac-4152-8c80-dbdcc79a1081"
/>


Find another library
<img width="706" height="492" alt="Untitled 8"
src="https://github.com/user-attachments/assets/62e2aff7-00d0-476a-a87f-a8b985ff988c"
/>

Confirm the pin and click "Do not show again"
<img width="828" height="560" alt="Untitled 9"
src="https://github.com/user-attachments/assets/a3ebefbb-196a-48cc-9a25-9726a08712d9"
/>

The second library is pinned and we have the option to reset the
confirmation dialog
<img width="742" height="496" alt="Untitled 10"
src="https://github.com/user-attachments/assets/8677bfef-184d-478b-bcee-c436fb1147d7"
/>
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