From 06c0b01f3a476e60a242bd2d5dbad8d33bcb29a7 Mon Sep 17 00:00:00 2001 From: Abe Jellinek Date: Tue, 12 Nov 2024 13:53:01 -0500 Subject: [PATCH] EPUB/Snapshot: Fix cycling between >2 overlapping annotations No need for a *good* sort function as long as it keeps things stable between renders. --- src/dom/common/dom-view.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/dom/common/dom-view.tsx b/src/dom/common/dom-view.tsx index 16fba0c0..88a4e0d5 100644 --- a/src/dom/common/dom-view.tsx +++ b/src/dom/common/dom-view.tsx @@ -953,7 +953,8 @@ abstract class DOMView { private _getAnnotationsAtPoint(clientX: number, clientY: number): string[] { return this._annotationShadowRoot.elementsFromPoint(clientX, clientY) .map(target => target.getAttribute('data-annotation-id')) - .filter(Boolean) as string[]; + .filter(Boolean) + .sort() as string[]; } private _handleAnnotationDragStart = (id: string, dataTransfer: DataTransfer) => {