1.9.3/1.9.4: Clicking outside a PDF annotation still opens its popup

Steps to reproduce

  1. Make sure the Obsidian version is 1.9.3 or 1.9.4
  2. Add this PDF file to the sandbox vault and open it: Lorem.Ipsum.pdf.zip (80.6 KB) (see “additional information” for how to reproduce this file)
  3. Click the area indicated by the red rectangle:

Did you follow the troubleshooting guide? [Y/N]

Y

Expected result

Since the click is outside of the yellow annotation, its popup should NOT open.

Actual result

The popup shows up despite the click being outside of the annotation.

Screen Recording 2025-06-30 at 22.34.27

Environment

SYSTEM INFO:
Obsidian version: v1.9.4
Installer version: v1.8.10
Operating system: Darwin Kernel Version 24.5.0: Tue Apr 22 19:48:46 PDT 2025; root:xnu-11417.121.6~2/RELEASE_ARM64_T8103 24.5.0
Login status: logged in
Language: en
Catalyst license: insider
Insider build toggle: on
Live preview: on
Base theme: adapt to system
Community theme: none
Snippets enabled: 0
Restricted mode: off
Plugins installed: 0
Plugins enabled: 0

RECOMMENDATIONS:
none


Additional information

Why this happens

In 1.9.3, the implementation of the getAnnotationFromEvt method of the internal PDF helper class changed.
In the new implementation, getAnnotationFromEvt calls AnnotationLayer.getAnnotationAtPoint (which I believe is not a part of the original PDF.js and was added by the Obsidian team).
This method iterates over the annotations in the page, and looks at each annotation’s quadPoints if it exists and rect otherwise.

The problem is that, the sample PDF has a text annotation and a pop-up annotation associated with it. The red area in the image above represents the pop-up annotation’s rect, which clearly does not corresponds to where the sticky note is displayed.
Therefore, for pop-up annotations, getAnnotationAtPoint needs to check parentRect instead of rect (or ignore them if they have parent annotations), I reckon.

Related parts of the PDF specification:

Steps to reproduce the sample PDF file:

  1. Download “Lorem Ipsum.pdf” from Sample PDFs · RyotaUshio/obsidian-pdf-plus Wiki · GitHub
  2. Open it with macOS’s Preview app, and add a new “Note”:
  3. Type a lot of characters in the popup and save.