Skip to content

Fix canvas description for v3 summaries and language-tagged v2 values - #4617

Merged
marlo-longley merged 1 commit into
ProjectMirador:mainfrom
MaxFreedomPollard:fix/canvas-summary
Oct 30, 2026
Merged

marlo-longley merged 1 commit into
ProjectMirador:mainfrom
MaxFreedomPollard:fix/canvas-summary

Conversation

@MaxFreedomPollard

Copy link
Copy Markdown
Contributor

The "Current item" section of the information panel never shows the summary of a Presentation 3 canvas, and a language-tagged Presentation 2 canvas description shows up as [object Object].

getCanvasDescription in src/state/selectors/canvases.js returned canvas.getProperty('description') as-is. Presentation 3 renamed that property to summary, and the spec says clients SHOULD render summary on a Canvas (3.0 § summary). So for v3 canvases the selector always returns undefined. For example, both canvases in https://iiif-test.github.io/March2025/manifests/manifest.json have a summary that is not displayed. In v2 the value can also be a language-tagged object or an array of them:

"description": [
  { "@value": "A description of the canvas", "@language": "en" },
  { "@value": "Une description du canevas", "@language": "fr" }
]

That value reaches SanitizedHtml unparsed, and DOMPurify turns it into the string [object Object],[object Object].

The selector now reads summary and falls back to description. It then picks the value for the current locale with PropertyValue.parse(...).getValue(locale), the same way the manifest summary is handled (#3633, #3780). It uses the same getManifestLocale as getCanvasLabel and getCanvasMetadata, so it also follows the locale picker. Plain string descriptions come back unchanged.

I added tests to __tests__/src/selectors/canvases.test.js for a v3 summary, a localized v2 description, and the two empty cases. I ran that file under Node 22 with a minimal jest-compatible runner against manifesto.js 4.3.5 and reselect 5.2.0. On main, the v3 and v2 cases fail: one returns undefined and the other returns the raw array. With this change all 26 tests in the file pass. I did not run lint, prettier or the full vitest suite locally.

🤖 Generated with Claude Code

getCanvasDescription returned the raw v2 `description` property. A
Presentation 3 canvas `summary` was therefore never shown in the
information panel, and a language-tagged v2 description reached
SanitizedHtml as an object or array and was rendered as
"[object Object]".

Read `summary`, falling back to `description`, and resolve it for the
current locale with PropertyValue, the same way the manifest summary is
handled.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@codecov

codecov Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.9%. Comparing base (7d861c8) to head (6a0ae04).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##            main   #4617     +/-   ##
=======================================
+ Coverage   94.9%   94.9%   +0.1%     
=======================================
  Files        394     394             
  Lines       5846    5848      +2     
  Branches    2002    2003      +1     
=======================================
+ Hits        5546    5548      +2     
  Misses       271     271             
  Partials      29      29             

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@marlo-longley
marlo-longley merged commit cd38d19 into ProjectMirador:main Oct 30, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants