Skip to content

Support for pin reordering (PP-3116) - #205

Open
tdilauro wants to merge 3 commits into
mainfrom
feature/pinning-reorder
Open

tdilauro wants to merge 3 commits into
mainfrom
feature/pinning-reorder

Conversation

@tdilauro

Copy link
Copy Markdown
Contributor

Description

Adds reordering of pinned libraries ("My Libraries") on the multi-library home page. It is behind the existing PALACE_CPW_FEATURE_PINNING feature flag.

  • Reorder mode: a Reorder button next to the "My Libraries" heading when two or more pinned libraries are shown. In reorder mode it reads Done.
  • In reorder mode, each pinned card shows:
    • a grip handle for mouse dragging;
    • stacked Move up and Move down buttons for keyboard use. At either end of the list the matching button is disabled but stays focusable.
  • In reorder mode, the cards:
    • show the library name as plain text, so clicking a card does not open the library;
    • have no hover effect;
    • show no pin button.
  • Moves:
    • the new order is saved to the browser right away;
    • moves are announced to screen readers ("Alpha Library moved to position 2 of 3.");
    • after a button move, focus stays on the pressed button.
  • Hidden pins: moves go to the position of a target library by id. So pinned libraries that are stored but not shown (missing from the server list) do not throw moves off.
  • Item landing page: shows the pinned order but offers no reordering.
  • New dependencies: @dnd-kit/core, @dnd-kit/sortable, @dnd-kit/utilities.
  • Translations: new strings in French, Italian, German, and Spanish. The reorder terms are added to the translation glossary.

Important

This branch is stacked on #203, which is, in turn, stacked on #202. Those must land before this PR is merged.

Motivation and Context

Patrons who pin several libraries may want their most used or preferred library(ies) first.

[Jira PP-3116]

How Has This Been Tested?

  • Manually tested in local dev environment (in Chromium and Safari browsers).
  • New tests for the new functionality.
  • All tests / checks pass locally and in CI.

Checklist:

  • N/A - I have updated the documentation accordingly.
  • All new and existing tests passed.

@tdilauro
tdilauro requested a review from a team September 28, 2026 02:50
@tdilauro
tdilauro added this pull request to stack #204 September 28, 2026 02:50
@tdilauro
tdilauro force-pushed the feature/pinning-reorder branch from 24cd2eb to 25f1432 Compare September 28, 2026 17:59
@coveralls

coveralls commented Sep 28, 2026 •

Copy link
Copy Markdown

Coverage Report for CI Build 36524452026

Coverage decreased (-0.6%) to 26.324%

Details

  • Coverage decreased (-0.6%) from the base build.
  • Patch coverage: 60 uncovered changes across 5 files (7 of 67 lines covered, 10.45%).
  • 2 coverage regressions across 1 file.

Uncovered Changes

File Changed Covered %
src/components/PinnedLibraryList.tsx 36 1 2.78%
src/components/MultiLibraryHome.tsx 8 0 0.0%
src/components/PinnedLibraryReorder.tsx 12 4 33.33%
src/utils/pinnedLibraries.ts 7 0 0.0%
src/components/context/PinnedLibrariesContext.tsx 2 0 0.0%
Total (7 files) 67 7 10.45%

Coverage Regressions

2 previously-covered lines in 1 file lost coverage.

File Lines Losing Coverage Coverage
src/components/PinnedLibraryList.tsx 2 1.27%

Coverage Stats

Coverage Status
Relevant Lines: 2475
Covered Lines: 764
Line Coverage: 30.87%
Relevant Branches: 1772
Covered Branches: 354
Branch Coverage: 19.98%
Branches in Coverage %: Yes
Coverage Strength: 8.59 hits per line

💛 - Coveralls

Base automatically changed from feature/pinning-basics to main September 29, 2026 04:54
@tdilauro
tdilauro force-pushed the feature/pinning-reorder branch from 25f1432 to 1cefd84 Compare September 29, 2026 05:04
</LibraryCardList>
{isReordering ? (
<DndContext
sensors={dragSensors}

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.

While manually testing dragging with a mouse, I noticed that I could pull a card far off to the right or the bottom of the screen. A separate package (@dnd-kit/modifiers) provides modifiersrestrictToVerticalAxis and restrictToParentElement that limit the range of a drag.

The current behavior is not a bug, because the cards snap back to the list without issue. I'm only mentioning in case you didn't know these options were available and you might like this behavior better.

Suggested change
sensors={dragSensors}
sensors={dragSensors}
// less restrictive
modifiers={[restrictToVerticalAxis]}
Suggested change
sensors={dragSensors}
sensors={dragSensors}
// more restrictive
modifiers={[restrictToParentElement]}

Comment on lines +275 to +293
{canReorder && (
<Button
variant="ghost"
color="ui.link.primary"
onClick={() => onReorderingChange?.(!isReordering)}
aria-label={
isReordering
? t(
"pinnedLibraryList.doneLabel",
"Done reordering My Libraries"
)
: t("pinnedLibraryList.reorderLabel", "Reorder My Libraries")
}
>
{isReordering
? t("pinnedLibraryList.done", "Done")
: t("pinnedLibraryList.reorder", "Reorder")}
</Button>
)}

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 button fails the WebAIM Contrast Checker for this font size when it is focused: https://webaim.org/resources/contrastchecker/?fcolor=0576D3&bcolor=CDE8FE

The default variant and color for Button passes (but is a little more boring 🙃)

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

@tdilauro looks great! Approving with a few small comments to consider.

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