Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-80593

All modals break because of config option debugtemplateinfo

XMLWordPrintable

    • MOODLE_402_STABLE, MOODLE_403_STABLE
    • MOODLE_403_STABLE, MOODLE_404_STABLE
    • MDL-80593-403-alt
    • MDL-80593-404-alt
    • MDL-80593-main-alt
    • Hide
      1. Log in as admin.
      2. Go to Site administration > Development > Debugging.
      3. Check the box for "Show template information" and save the changes.
      4. Navigate to the Dashboard.
      5. Click on the "New event" button in the Calendar block.
      6. Confirm that you see the "New event" dialogue.
      7. Inspect the modal element.
      8. Confirm that you see the following HTML comments:

        <!-- template(JS): modal_event_form -->

        <!-- template(JS): modal -->

        <!-- /template(JS): modal -->

        <!-- /template(JS): modal_event_form -->

      Show
      Log in as admin. Go to Site administration > Development > Debugging. Check the box for "Show template information" and save the changes. Navigate to the Dashboard. Click on the "New event" button in the Calendar block. Confirm that you see the "New event" dialogue. Inspect the modal element. Confirm that you see the following HTML comments: <!-- template(JS): modal_event_form --> <!-- template(JS): modal --> <!-- /template(JS): modal --> <!-- /template(JS): modal_event_form -->
    • 6
    • Team Hedgehog 2024 Review 2, Team Hedgehog 2024 Sprint 3.1

      As soon as the config option debugtemplateinfo is enabled, all modals will break with JS error lockRegion.querySelectorAll is not a function

      I already hardened the language string via AMOS to warn more explicitely when enabling this config switch.

      In addition to that, IMO the modal JS module should be hardened to not rely on the fact that the "first" child object is being used, because the root of the error is that the first child object suddenly is the template comment instead of the correct child object.

      Problem cause:

      https://github.com/moodle/moodle/blob/580c009cacbd1093037599b2b92716154199a77e/lib/amd/src/modal.js#L286

      Here the element root[0] is the comment object if $CFG->debugtemplateinfo is enabled instead of the correct DOM element.

        1. image-2024-08-08-08-37-11-304.png
          24 kB
          Amaia Anabitarte
        2. image-2024-08-08-08-39-04-048.png
          27 kB
          Amaia Anabitarte

            huongn@moodle.com Huong Nguyen
            phmemmel PhMemmel
            David Woloszyn David Woloszyn
            Andrew Lyons Andrew Lyons
            Amaia Anabitarte Amaia Anabitarte
            Votes:
            4 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 days, 3 hours, 35 minutes
                2d 3h 35m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.