Skip to content

[v1.5.8] [Moodle 4.4.9/4.5.6] [PHP 8.1] Console errors on mobile when using rectangle comment mode #157

@danowar2k

Description

@danowar2k

Moodle Version in use

  • Moodle 4.4.9
  • Moodle 4.5.6

** Plugin Version **

v1.5.8 (2025032500)

Describe the bug

Similar to #156...and yet more.

When using a smartphone in a PDF annotator, and you are in rectangle mode and select a rectangle in the PDF, a console error appears. When you then select the "select mode" (hand), another console error appears. If you then select the rectangle in select mode, a third error appears. And when you click on the X to delete the rectangle, a final one appears.

In addition to that, sometimes the text editor for the comment appears and sometimes it doesn't. We can't yet discern when.

The errors:

(1) After creating a rectangle and then lifting the finger:

Uncaught TypeError: Cannot set properties of null (setting 'placeholder')
    at openComment (index.js?ver=00039:6830:38)
    at HTMLDocument.handleDocumentTouchend (index.js?ver=00039:6161:70)

(2) After selecting "select mode" after that:

Uncaught TypeError: Cannot set properties of null (setting 'value')
    at closeComment (index.js?ver=00039:6774:74)
    at HTMLDivElement.handleToolbarClick (index.js?ver=00039:6181:45)

(3) Selecting the empty rectangle when in select mode:

POST BASEURL/mod/pdfannotator/action.php 404 (Not Found)
send @ jquery-3.7.1.min.js:2
ajax @ jquery-3.7.1.min.js:2
getComments @ index.js?ver=00039:471
(anonymous) @ index.js?ver=00039:1891
handleAnnotationClick @ index.js?ver=00039:1983
EventEmitter.emit @ index.js?ver=00039:4009
handleDocumentClickFunction @ index.js?ver=00039:3898
handleDocumentClick @ index.js?ver=00039:3950

(4) After tapping on the X of the rectangle (page is not reloaded, instead JS notifications appear):

Notification: Deletion not allowedfalse
Notification: An error has occurred while getting the comments

To Reproduce
Steps to reproduce the behavior:

  1. Create a pdfannotator, settings don't matter
  2. Using a smartphone, open the pdfannotator
  3. Activate pin mode
  4. Touch a spot on the PDF to add a pin.
  5. Error (1) appears when you "touch up" (lift the finger)
  6. Select "select mode"
  7. Error (2) appears right after you changed the mode
  8. Select the rectangle by tapping it
  9. Error (3) appears after the rectangle is selected

Expected behavior
No console error should be shown, and the comment editor should always show.

Screenshots
None

Smartphone (please complete the following information):

  • Device: Samsung Galaxy S21+
  • OS: Android 15
  • Browser: Android Chrome
  • Version: 140.0.7339.51

Metadata

Metadata

Assignees

No one assigned

    Labels

    NextReleasemarked issues will be fixed in next release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions