Summary
In Diva 7.5.2, the annotation details panel can remain open after the selected annotation is removed. This is an upstream annotation lifecycle issue, not a defect in Cantus OMR highlight rendering.
Affected area
src/viewer-element.ts, class OsdViewer:
setAnnotations replaces canvas annotation data and updates overlays without clearing a selection that no longer exists.
setTileSources clears annotation data without closing the annotation panel or clearing selectedAnnotationId.
Reproduction
- Load a canvas with an annotation.
- Select the annotation to open its details panel.
- Replace that canvas's annotations with an empty list.
- Observe that the overlay disappears but the details panel remains open with the removed annotation's content.
Changing tile sources after opening the panel can also leave stale annotation details visible.
Required changes
After replacing canvas annotations, check whether the selected annotation still exists across the stored canvas annotations. If it does not, clear selectedAnnotationId and close the annotation panel. Apply the same cleanup when setTileSources clears annotation data.
Preserve the selection when the selected annotation still exists, including when annotations on an unrelated canvas change.
Acceptance criteria
- Removing the selected annotation closes its details panel and clears its selection.
- Replacing tile sources closes stale annotation details and clears the selection.
- Updating an unrelated canvas does not clear a valid selection.
- Add regression coverage for these annotation lifecycle cases.
Context
Filed at @ahankinson's request.
Summary
In Diva 7.5.2, the annotation details panel can remain open after the selected annotation is removed. This is an upstream annotation lifecycle issue, not a defect in Cantus OMR highlight rendering.
Affected area
src/viewer-element.ts, classOsdViewer:setAnnotationsreplaces canvas annotation data and updates overlays without clearing a selection that no longer exists.setTileSourcesclears annotation data without closing the annotation panel or clearingselectedAnnotationId.Reproduction
Changing tile sources after opening the panel can also leave stale annotation details visible.
Required changes
After replacing canvas annotations, check whether the selected annotation still exists across the stored canvas annotations. If it does not, clear
selectedAnnotationIdand close the annotation panel. Apply the same cleanup whensetTileSourcesclears annotation data.Preserve the selection when the selected annotation still exists, including when annotations on an unrelated canvas change.
Acceptance criteria
Context
Filed at @ahankinson's request.