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

Modal close button does not respect setRemoveOnClose value

XMLWordPrintable

    • MOODLE_400_STABLE, MOODLE_401_STABLE, MOODLE_402_STABLE
    • MOODLE_400_STABLE, MOODLE_401_STABLE
    • MDL-77420-401
    • MDL-77420-master
    • Hide
      1. Create a course in topics format with at least one activity
      2. Go to the course as admin and turn edit on
      3. Open the browser console (usually F12)
      4. Execute in the browser console: document.querySelectorAll('.modal').length
        1. Check the result is 0
      5. Open one activity actions dropdown and select the "Move" action
      6. Execute in the browser console: document.querySelectorAll('.modal').length
        1. Check the result is 1
      7. Close the move modal with the X button on the top of the modal
      8. Execute in the browser console: document.querySelectorAll('.modal').length
        1. Check the result is 0

       

      Show
      Create a course in topics format with at least one activity Go to the course as admin and turn edit on Open the browser console (usually F12) Execute in the browser console: document.querySelectorAll('.modal').length Check the result is 0 Open one activity actions dropdown and select the "Move" action Execute in the browser console: document.querySelectorAll('.modal').length Check the result is 1 Close the move modal with the X button on the top of the modal Execute in the browser console: document.querySelectorAll('.modal').length Check the result is 0  
    • HQ 2023 Sprint i1.2 Moppies

      In core/modal module, the close icon  executes this.hide() instead of check  
      this.removeOnClose to execute hide or destroy depending on the value. However, the "esc" key to close the modal does it. The behaviour should be consistent, otherwise opening a modal leaves unwanted HTML in the page depending on how the modal is closed.
       
      Steps to reproduce: # Open a course in edit mode

      1. In the browser inspector, find ".modal" returns zero results.
      2. Open an activity dropdown and click on the move option
      3. In the browser inspector, find ".modal" returns 1 result.
      4. Click on the modal title to return the focus to the page and press "esc" to close the modal
      5. In the browser inspector, find ".modal" returns zero results.
      6. Open an activity dropdown again and click on the move option
      7. Close the modal with the X button
      8. Expected: In the browser inspector, find ".modal" should return zero results.
      9. What happens: In the browser inspector, find ".modal" returns 1 result.

      Technical shaping

      The error is located in the core/modal module in the registerEventListeners method.

      In modal.js #827 the keydown event is clearly checking the remove on close value while in modal.js #856 ignores it and executes hide directly.

        1. (I) Passed -- (400)MDL-77420.png
          121 kB
          Kim Jared Lucas
        2. (I) Passed -- (401)MDL-77420.png
          109 kB
          Kim Jared Lucas
        3. (I) Passed -- (Master)MDL-77420.png
          121 kB
          Kim Jared Lucas

            tusefomal Ferran Recio
            tusefomal Ferran Recio
            Laurent David Laurent David
            Andrew Lyons Andrew Lyons
            Kim Jared Lucas Kim Jared Lucas
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 3 hours, 31 minutes
                3h 31m

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