Moodle
  1. Moodle
  2. MDL-34209

Moving sections by drag and drop causes the sections to be reordered

    Details

    • Testing Instructions:
      Hide

      You must do this for the following course formats:

      • topics (core)
      • weekly (core)
      • one of the grid formats (third-party)

      Each section should have a couple of differently named resources in it to help identify the sections from one another (not all of the same type).

      • Open a course
      • Turn editing on
      • Select a course section and drag it one section below
        • Confirm that the title was updated correctly
        • Confirm that the contents of the section were updated correctly
      • Refresh the page
        • Confirm that the title was updated correctly
        • Confirm that the contents of the section were updated correctly
      • Drag it back up to it's original location
      • Refresh the page
        • Confirm that the title was updated correctly
        • Confirm that the contents of the section were updated correctly
      • Drag the section down two sections, and then up a section (without * releasing the drag)
        • Confirm that the title was updated correctly
        • Confirm that the contents of the section were updated correctly
      • Drag it back up to it's original location
      • Refresh the page
        • Confirm that the title was updated correctly
        • Confirm that the contents of the section were updated correctly
      • Drag the section down two sections and release
        • Confirm that the title was updated correctly
        • Confirm that the contents of the section were updated correctly
      • Drag the section down a bit further - off the screen such that you invoke the scrolling action, and release
        • Confirm that the title was updated correctly
        • Confirm that the contents of the section were updated correctly
      • Refresh the page
        • Confirm that the title was updated correctly
        • Confirm that the contents of the section were updated correctly
      • Drag the section back up to the top, and then down one and release
        • Confirm that the title was updated correctly
        • Confirm that the contents of the section were updated correctly
      • Refresh the page
        • Confirm that the title was updated correctly
        • Confirm that the contents of the section were updated correctly
      • Pick up a section and move it up and down the page repeatedly before eventually dropping
        • Confirm that the title was updated correctly
        • Confirm that the contents of the section were updated correctly
      • Refresh the page
        • Confirm that the title was updated correctly
        • Confirm that the contents of the section were updated correctly
      • Have a general play around and make sure that everything lands in the right places
      • Now repeat the above with sections, and blocks.
      Show
      You must do this for the following course formats: topics (core) weekly (core) one of the grid formats (third-party) Each section should have a couple of differently named resources in it to help identify the sections from one another (not all of the same type). Open a course Turn editing on Select a course section and drag it one section below Confirm that the title was updated correctly Confirm that the contents of the section were updated correctly Refresh the page Confirm that the title was updated correctly Confirm that the contents of the section were updated correctly Drag it back up to it's original location Refresh the page Confirm that the title was updated correctly Confirm that the contents of the section were updated correctly Drag the section down two sections, and then up a section (without * releasing the drag) Confirm that the title was updated correctly Confirm that the contents of the section were updated correctly Drag it back up to it's original location Refresh the page Confirm that the title was updated correctly Confirm that the contents of the section were updated correctly Drag the section down two sections and release Confirm that the title was updated correctly Confirm that the contents of the section were updated correctly Drag the section down a bit further - off the screen such that you invoke the scrolling action, and release Confirm that the title was updated correctly Confirm that the contents of the section were updated correctly Refresh the page Confirm that the title was updated correctly Confirm that the contents of the section were updated correctly Drag the section back up to the top, and then down one and release Confirm that the title was updated correctly Confirm that the contents of the section were updated correctly Refresh the page Confirm that the title was updated correctly Confirm that the contents of the section were updated correctly Pick up a section and move it up and down the page repeatedly before eventually dropping Confirm that the title was updated correctly Confirm that the contents of the section were updated correctly Refresh the page Confirm that the title was updated correctly Confirm that the contents of the section were updated correctly Have a general play around and make sure that everything lands in the right places Now repeat the above with sections, and blocks.
    • Affected Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE
    • Fixed Branches:
      MOODLE_24_STABLE, MOODLE_25_STABLE
    • Pull 2.4 Branch:
    • Pull 2.5 Branch:
    • Pull Master Branch:
      MDL-34209-master
    • Story Points:
      20
    • Rank:
      52964
    • Sprint:
      FRONTEND Sprint 6

      Description

      When I move the sections in my course, they will sometimes reorder randomly.

      What I did:
      1. Created a bunch of sections (I have 15)
      2. Added content to some of the sections
      3. Added a section to the end using the plus icon
      4. Tried to drag and drop it to a location higher up on the page

      What I expected:
      The section to drop into the new location.

      What actually happens:
      The section drops into a random location and the other sections reorder randomly as well.

      This happens about every 4th time I try to reorder a section.

        Issue Links

          Activity

          Hide
          Michael Woods added a comment -

          My sections move correctly via ajax in edit mode, but upon clicking Save, they revert back to their original positions. It's causing major headaches on our site!

          Is this what you are experiencing, or is it the actual dragging and placing of sections that's causing problems?

          Show
          Michael Woods added a comment - My sections move correctly via ajax in edit mode, but upon clicking Save, they revert back to their original positions. It's causing major headaches on our site! Is this what you are experiencing, or is it the actual dragging and placing of sections that's causing problems?
          Hide
          Kristi added a comment -

          Hi Michael.

          In short: both. Like on your site, the sections almost never stay where they are put when the page is refreshed or editing is turned off. However, sometimes the other sections actually move randomly too. Then I have to try and reorder a number of sections. This is especially apparent with larger sections that I need to scroll to move. What a long week it has been!

          Is there any way to turn the drag and drop off and just move them the old way?

          Show
          Kristi added a comment - Hi Michael. In short: both. Like on your site, the sections almost never stay where they are put when the page is refreshed or editing is turned off. However, sometimes the other sections actually move randomly too. Then I have to try and reorder a number of sections. This is especially apparent with larger sections that I need to scroll to move. What a long week it has been! Is there any way to turn the drag and drop off and just move them the old way?
          Hide
          Michael Woods added a comment -

          I'm sorry, I don't know. I'd like an option to be able to turn off the drag and drop of sections too.

          Show
          Michael Woods added a comment - I'm sorry, I don't know. I'd like an option to be able to turn off the drag and drop of sections too.
          Hide
          Michael Woods added a comment -

          Interestingly, our staff are reporting that the difficulty in making a dragged section 'stick' after turning editing off is in the upgraded courses (from 1.9.x), NOT in brand new courses (ones created after the upgrade).

          Show
          Michael Woods added a comment - Interestingly, our staff are reporting that the difficulty in making a dragged section 'stick' after turning editing off is in the upgraded courses (from 1.9.x), NOT in brand new courses (ones created after the upgrade).
          Hide
          Kristi added a comment -

          That is interesting. Unfortunately we have no upgraded courses so it's happening in the new courses.

          Show
          Kristi added a comment - That is interesting. Unfortunately we have no upgraded courses so it's happening in the new courses.
          Hide
          Eric Merrill added a comment -

          We are seeing the same problem. In some courses drag and drop of topics doesn't work, but not consistently. Sometimes it works, sometimes it works after the first try on a page load (2nd and onward drags work), but this is when the ordering becomes confusing, as the orders don't match.

          Show
          Eric Merrill added a comment - We are seeing the same problem. In some courses drag and drop of topics doesn't work, but not consistently. Sometimes it works, sometimes it works after the first try on a page load (2nd and onward drags work), but this is when the ordering becomes confusing, as the orders don't match.
          Hide
          Beth Crook added a comment -

          We are having the same issue. We'll move a section and it won't stick and many times all of the other sections get reordered even though they weren't moved in the first place. Faculty are getting very frustrated with this.

          Show
          Beth Crook added a comment - We are having the same issue. We'll move a section and it won't stick and many times all of the other sections get reordered even though they weren't moved in the first place. Faculty are getting very frustrated with this.
          Hide
          Derek Chirnside added a comment -

          This from the forums:
          http://moodle.org/mod/forum/discuss.php?d=209920&parent=915506

          "I was able to solve a similar issue by temporarily turning off AJAX in the admin settings. I then used the 'old' arrow buttons to rearrange the sections correctly. Perhaps you could try that"

          I had this happen to me the other day. Really screwy. I shut everything down, had a coffee and when I came back it was OK. I can't even remember what browser, old or imported course etc. I've tried to reproduce since I saw this report to no avail. Maybe it was the coffee that fixed it.

          Show
          Derek Chirnside added a comment - This from the forums: http://moodle.org/mod/forum/discuss.php?d=209920&parent=915506 "I was able to solve a similar issue by temporarily turning off AJAX in the admin settings. I then used the 'old' arrow buttons to rearrange the sections correctly. Perhaps you could try that" I had this happen to me the other day. Really screwy. I shut everything down, had a coffee and when I came back it was OK. I can't even remember what browser, old or imported course etc. I've tried to reproduce since I saw this report to no avail. Maybe it was the coffee that fixed it.
          Hide
          Lauren Nicandri added a comment -

          We are experiencing similar issues with topic boxes not sticking to the location they are moved to. Sometimes they will appear to stay, visually, but if a user goes back, it will have reverted back to its previous location. Other times, it will not drag to the appropriate location and simply jump back to its original spot.

          This is a problem with not only topic boxes, but also resource dragging/relocation.

          Show
          Lauren Nicandri added a comment - We are experiencing similar issues with topic boxes not sticking to the location they are moved to. Sometimes they will appear to stay, visually, but if a user goes back, it will have reverted back to its previous location. Other times, it will not drag to the appropriate location and simply jump back to its original spot. This is a problem with not only topic boxes, but also resource dragging/relocation.
          Hide
          David Longman added a comment -

          So glad I have found this tracker section! This issue has been driving me mad. Glad to have it confirmed by these reports. It's early days with Moodle 2.3 at our place and I don't think anyone believed me when I reported exactly what has been listed here. I have experienced all these issues plus a new one: today I somehow managed to put two topics into two orphaned activities sections! I'm having to move contents back item by item as no way to drag all at once ... this is not a good feature! My sysadmin does not want to turn off Ajax if he can at all help it.

          Fix: Bring back a way to switch on the old buttons.

          Fix 2: A simpler fix might be to provide a backroom page that lists the topic titles and provides the standard move buttons so user can re-order topic order by re-ordering title list (as in other settings pages).

          PS coffee theory incorrect I'm afraid. Moodle still muddled even after whole pot!

          Show
          David Longman added a comment - So glad I have found this tracker section! This issue has been driving me mad. Glad to have it confirmed by these reports. It's early days with Moodle 2.3 at our place and I don't think anyone believed me when I reported exactly what has been listed here. I have experienced all these issues plus a new one: today I somehow managed to put two topics into two orphaned activities sections! I'm having to move contents back item by item as no way to drag all at once ... this is not a good feature! My sysadmin does not want to turn off Ajax if he can at all help it. Fix: Bring back a way to switch on the old buttons. Fix 2: A simpler fix might be to provide a backroom page that lists the topic titles and provides the standard move buttons so user can re-order topic order by re-ordering title list (as in other settings pages). PS coffee theory incorrect I'm afraid. Moodle still muddled even after whole pot!
          Hide
          Itamar Tzadok added a comment -

          Fix for 2:

          See http://moodle.org/mod/forum/discuss.php?d=212254#p926433 for a new course_navigation block plugin that allows you to do exactly that. You don't have to use it for navigation if you're happy with other methods. But you can add it to the course for this feature (more to come) and keep it hidden when not in use. With the block in the course you go to the block configuration which should display among other things the list of course sections in a text area (section 0 excluded). Enable 'Use hierarchy' to activate, change the order of the sections (you can also change the section names but keep the format name|id), enable 'Update order' (and 'Update names' if needed) and save the configuration. With a bit of luck order (and names if enabled) will be updated. This feature will be populated from the block configuration to the block display in subsequent versions of the plugin.

          Show
          Itamar Tzadok added a comment - Fix for 2: See http://moodle.org/mod/forum/discuss.php?d=212254#p926433 for a new course_navigation block plugin that allows you to do exactly that. You don't have to use it for navigation if you're happy with other methods. But you can add it to the course for this feature (more to come) and keep it hidden when not in use. With the block in the course you go to the block configuration which should display among other things the list of course sections in a text area (section 0 excluded). Enable 'Use hierarchy' to activate, change the order of the sections (you can also change the section names but keep the format name|id), enable 'Update order' (and 'Update names' if needed) and save the configuration. With a bit of luck order (and names if enabled) will be updated. This feature will be populated from the block configuration to the block display in subsequent versions of the plugin.
          Hide
          Itamar Tzadok added a comment -

          Forgot to mention Workaround for 1: The Profile switches plugin (http://moodle.org/plugins/view.php?plugin=local_profileswitches) that allows you to switch ajax on/off from the settings block in the course page and this works also in 2.3 where the ajax user profile setting no longer exists.

          Show
          Itamar Tzadok added a comment - Forgot to mention Workaround for 1: The Profile switches plugin ( http://moodle.org/plugins/view.php?plugin=local_profileswitches ) that allows you to switch ajax on/off from the settings block in the course page and this works also in 2.3 where the ajax user profile setting no longer exists.
          Hide
          Lisa Glass added a comment -

          I too am experiencing this issue.

          Show
          Lisa Glass added a comment - I too am experiencing this issue.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          U P S T R E A M I Z E D !

          Many thanks, this is now available in all the repos (git & cvs).

          Closing, ciao

          Show
          Eloy Lafuente (stronk7) added a comment - U P S T R E A M I Z E D ! Many thanks, this is now available in all the repos (git & cvs). Closing, ciao
          Hide
          Lauren Nicandri added a comment -

          Eloy,

          Can you provide a link to the fix? Thanks!

          Show
          Lauren Nicandri added a comment - Eloy, Can you provide a link to the fix? Thanks!
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Doh,

          somehow this issue was closed incorrectly when processing all the integrated issues this week. (sort of most voted and current in integration filters mix). Apologies for the confusion, reseting to previous status!

          Ciao, Eloy

          Show
          Eloy Lafuente (stronk7) added a comment - Doh, somehow this issue was closed incorrectly when processing all the integrated issues this week. (sort of most voted and current in integration filters mix). Apologies for the confusion, reseting to previous status! Ciao, Eloy
          Hide
          Debby Kurti added a comment -

          I agree with all of the comments above. This is just about bad enough to make me want to jump to another CMS. I don't have admin access in this particular installation so it doesn't seem like there is anything I can do to fix it. I keep trying to reorganize 18 topics and it seems they just randomly go wherever they want to. Tried different browsers (chrome, firefox, safari) with same results. My preference is to have the up/down arrows back!

          Show
          Debby Kurti added a comment - I agree with all of the comments above. This is just about bad enough to make me want to jump to another CMS. I don't have admin access in this particular installation so it doesn't seem like there is anything I can do to fix it. I keep trying to reorganize 18 topics and it seems they just randomly go wherever they want to. Tried different browsers (chrome, firefox, safari) with same results. My preference is to have the up/down arrows back!
          Hide
          Eric Merrill added a comment -

          Debby -

          As an end user, and way around this is to turn off Javascript in your browser. Turn it off, you will get the arrows when you go to the course page, move them around, then turn JS back on when you are done.

          Show
          Eric Merrill added a comment - Debby - As an end user, and way around this is to turn off Javascript in your browser. Turn it off, you will get the arrows when you go to the course page, move them around, then turn JS back on when you are done.
          Hide
          Debby Kurti added a comment -

          Thanks, that worked. Ironically, I couldn't respond here until I turned it back on. It would be nice if moodle came out with a fix for this instead of work-arounds

          Show
          Debby Kurti added a comment - Thanks, that worked. Ironically, I couldn't respond here until I turned it back on. It would be nice if moodle came out with a fix for this instead of work-arounds
          Hide
          Eric Merrill added a comment -

          I agree - I don't want to give you the impression I represent Moodle in any way (I work at a university), I just wanted to let you know this is a workaround.

          Show
          Eric Merrill added a comment - I agree - I don't want to give you the impression I represent Moodle in any way (I work at a university), I just wanted to let you know this is a workaround.
          Hide
          Derek Chirnside added a comment -

          I hope this is not a red herring. I've been working on a tiny course (five sections with nothing in three of them) FF and Moodle 2.3.2+ (Build: 20121014)
          I'm now back to inconsistently getting failed moves using drag and drop. Sometimes when I move, the Topic number changes correctly. Other times it stays the same. Clicking refresh about 2/3 oe 3/4 returns the sections to the old order.
          I think if I do it too fast it fails more often. Slower seems better.
          I think if I shift the last one of five up to position 4 it seems to fail consistently.
          I think when I move section five to position one it succeeds most of the time.
          So I set up a course with named sections in Moodle demo to have a go and then the course reset. I'll have a go later with demo.moodle.

          Questions to the developers: I'm assuming if we get consistent behaviour on demo.moodle it can help you more? Is anything more current on this issue?

          -Derek

          Show
          Derek Chirnside added a comment - I hope this is not a red herring. I've been working on a tiny course (five sections with nothing in three of them) FF and Moodle 2.3.2+ (Build: 20121014) I'm now back to inconsistently getting failed moves using drag and drop. Sometimes when I move, the Topic number changes correctly. Other times it stays the same. Clicking refresh about 2/3 oe 3/4 returns the sections to the old order. I think if I do it too fast it fails more often. Slower seems better. I think if I shift the last one of five up to position 4 it seems to fail consistently. I think when I move section five to position one it succeeds most of the time. So I set up a course with named sections in Moodle demo to have a go and then the course reset. I'll have a go later with demo.moodle. Questions to the developers: I'm assuming if we get consistent behaviour on demo.moodle it can help you more? Is anything more current on this issue? -Derek
          Hide
          Anatol Bogun added a comment -

          We are experiencing a lot of issues and have frustrated lecturers because of the unreliable drag move feature, particularly of sections. For us it would be sufficient to have two simple site wide yes/no Moodle settings:

          • use arrows instead of drag move to move sections (yes/no)
          • use arrows instead of drag move to move course modules (yes/no)

          This would be a better option than turning off Ajax across the entire site.

          Show
          Anatol Bogun added a comment - We are experiencing a lot of issues and have frustrated lecturers because of the unreliable drag move feature, particularly of sections. For us it would be sufficient to have two simple site wide yes/no Moodle settings: use arrows instead of drag move to move sections (yes/no) use arrows instead of drag move to move course modules (yes/no) This would be a better option than turning off Ajax across the entire site.
          Hide
          Brandon Poyner added a comment -

          I'm also just an interested party in seeing this issue fixed. I believe I've found how to disable the AJAX drag-and-drop section reordering without touching any other AJAX functionality. I've only rolled this change into my test system at this time, if anybody else wants to try it here's a link to my unix diff file.

          http://web.acd.ccac.edu/~bpoyner/moodle/section-ajax-patch.diff

          Show
          Brandon Poyner added a comment - I'm also just an interested party in seeing this issue fixed. I believe I've found how to disable the AJAX drag-and-drop section reordering without touching any other AJAX functionality. I've only rolled this change into my test system at this time, if anybody else wants to try it here's a link to my unix diff file. http://web.acd.ccac.edu/~bpoyner/moodle/section-ajax-patch.diff
          Hide
          Michael Woods added a comment -

          I'm wondering if the priority should be raised from Minor? The definition of Minor is "Minor loss of function, where workaround is possible". Is the workaround turning off javascript in a client browser, then remembering to turn back on? Realistically, it seems beyond the technical skill of the average person.

          Show
          Michael Woods added a comment - I'm wondering if the priority should be raised from Minor? The definition of Minor is "Minor loss of function, where workaround is possible". Is the workaround turning off javascript in a client browser, then remembering to turn back on? Realistically, it seems beyond the technical skill of the average person.
          Hide
          Michael Woods added a comment -

          Brandon - your patch seems to work, thanks. Anyone else tried it?

          Show
          Michael Woods added a comment - Brandon - your patch seems to work, thanks. Anyone else tried it?
          Hide
          Brandon Poyner added a comment -

          I've rolled the above patch into our live system. Our use of Moodle is relatively light compared to BlackBoard so it might take a while for any possible problems to crop up. I'll post here if anything does.

          I've created an alternate patch, one I'm not going to use myself, that keeps the AJAX section reordering and brings the arrows back. I haven't tested it very much and is not to be used in combination with the patch above. You also have to go to Site Administration -> Development -> Purge all caches after applying the patch.

          http://web.acd.ccac.edu/~bpoyner/moodle/section-ajax-patch2.diff

          Show
          Brandon Poyner added a comment - I've rolled the above patch into our live system. Our use of Moodle is relatively light compared to BlackBoard so it might take a while for any possible problems to crop up. I'll post here if anything does. I've created an alternate patch, one I'm not going to use myself, that keeps the AJAX section reordering and brings the arrows back. I haven't tested it very much and is not to be used in combination with the patch above. You also have to go to Site Administration -> Development -> Purge all caches after applying the patch. http://web.acd.ccac.edu/~bpoyner/moodle/section-ajax-patch2.diff
          Hide
          Julie Grundy added a comment -

          I'd like the Priority upgraded on this request - it prevents course creators from getting courses set up in a timely manner. Turning off Ajax for the entire site is too extreme to be classed as a workaround, and asking non-developer staff to turn Javascript on and off every time they want to move a section is out of the question.

          If the drag'n'drop functionality is too difficult to fix quickly, would it be possible to return the ability to turn off Ajax on a per-user basis? Or to add an option to choose between drag'n'drop and up/down arrows either site-wide or per user? Drag'n'drop isn't great for keyboard accessibility (i.e. for everyone working on a laptop without a mouse) compared to the arrow feature.

          Show
          Julie Grundy added a comment - I'd like the Priority upgraded on this request - it prevents course creators from getting courses set up in a timely manner. Turning off Ajax for the entire site is too extreme to be classed as a workaround, and asking non-developer staff to turn Javascript on and off every time they want to move a section is out of the question. If the drag'n'drop functionality is too difficult to fix quickly, would it be possible to return the ability to turn off Ajax on a per-user basis? Or to add an option to choose between drag'n'drop and up/down arrows either site-wide or per user? Drag'n'drop isn't great for keyboard accessibility (i.e. for everyone working on a laptop without a mouse) compared to the arrow feature.
          Hide
          Richard Oelmann added a comment -

          Julie - while not 100% ideal, as its not in core at the moment, see Itamar's post (29/Sep/12 11:47 PM) for a link to a plugin which allows individual users to turn ajax on and off allowing them to get access to the 'old' style arrows rather than the drag and drop. I've been using that with great success for the last few months for users who prefered the arrows to the drag and drop of sections. I haven't tried Brandon's solution as yet as I'm waiting to see what happens with 2.4

          Show
          Richard Oelmann added a comment - Julie - while not 100% ideal, as its not in core at the moment, see Itamar's post (29/Sep/12 11:47 PM) for a link to a plugin which allows individual users to turn ajax on and off allowing them to get access to the 'old' style arrows rather than the drag and drop. I've been using that with great success for the last few months for users who prefered the arrows to the drag and drop of sections. I haven't tried Brandon's solution as yet as I'm waiting to see what happens with 2.4
          Hide
          Julie Grundy added a comment -

          Thanks, Richard, I'll give that a try. The documentation on the difference between having Ajax enabled or not is pretty thin, so I'm sure I'm not the only user reluctant to un-tick the enableajax box without being sure of the consequences across the site.

          Show
          Julie Grundy added a comment - Thanks, Richard, I'll give that a try. The documentation on the difference between having Ajax enabled or not is pretty thin, so I'm sure I'm not the only user reluctant to un-tick the enableajax box without being sure of the consequences across the site.
          Hide
          Richard Oelmann added a comment -

          I agree Julie - I was not willing to turn it off across the whole site, but this plugin gives each user the option to turn it off individually and it makes it quite straightforward to turn it off just when needed and turn it back on again afterwards I hope its of some help for you!

          Show
          Richard Oelmann added a comment - I agree Julie - I was not willing to turn it off across the whole site, but this plugin gives each user the option to turn it off individually and it makes it quite straightforward to turn it off just when needed and turn it back on again afterwards I hope its of some help for you!
          Hide
          Heiko Schach added a comment - - edited

          Ajax is enabled by default in Moodle 2.3, so when we upgraded to 2.3.3 last week we decided to enable Ajax for the first time on our site.

          Since then we have received reports about unreliable course sections drag move feature, orphaned activities included.
          After some testing we can confirm the problem still persists.

          Brandon's workarounds helped. Thanks Brandon!
          Still, it would be good to see this issue fixed.

          Show
          Heiko Schach added a comment - - edited Ajax is enabled by default in Moodle 2.3, so when we upgraded to 2.3.3 last week we decided to enable Ajax for the first time on our site. Since then we have received reports about unreliable course sections drag move feature, orphaned activities included. After some testing we can confirm the problem still persists. Brandon's workarounds helped. Thanks Brandon! Still, it would be good to see this issue fixed.
          Hide
          Chris Myers added a comment - - edited

          Brandon's workaround helped us as well We were running into an issue where you could rearrange topics in the topics format, or drag resources between different topics/weeks, but you couldn't rearrange/reorder the weeks.

          Show
          Chris Myers added a comment - - edited Brandon's workaround helped us as well We were running into an issue where you could rearrange topics in the topics format, or drag resources between different topics/weeks, but you couldn't rearrange/reorder the weeks.
          Hide
          Paul P added a comment -

          I have been struggling with this for a few weeks now and I believe that the problem occurs when you try to move a section too soon after moving another section. I first applied the fix in MDL-34798 (https://tracker.moodle.org/browse/MDL-34798) and that seemed to help, but after much testing I was still able to mess up the sections. It usually resolved itself upon refreshing the page, but it led me to two thoughts:

          1) Perhaps the moving of topics can be "locked" until the js is ccompleted
          2) Force a page refresh upon moving

          Just my two cents.

          Show
          Paul P added a comment - I have been struggling with this for a few weeks now and I believe that the problem occurs when you try to move a section too soon after moving another section. I first applied the fix in MDL-34798 ( https://tracker.moodle.org/browse/MDL-34798 ) and that seemed to help, but after much testing I was still able to mess up the sections. It usually resolved itself upon refreshing the page, but it led me to two thoughts: 1) Perhaps the moving of topics can be "locked" until the js is ccompleted 2) Force a page refresh upon moving Just my two cents.
          Hide
          moodle support UQAT added a comment -

          Hi, we have the same problem with version 2,4, do plan to try to solve this problem ?
          We don't want to deactivate the Ajax.
          Luc

          Show
          moodle support UQAT added a comment - Hi, we have the same problem with version 2,4, do plan to try to solve this problem ? We don't want to deactivate the Ajax. Luc
          Hide
          Michael Woods added a comment -

          We recently upgraded from 2.3.6 to 2.4.3, so I thought I would leave our site unpatched (ie. allow all Ajax drag drop again), however I've had immediate complaints from multiple staff about resources and sections re-ordering themselves once editing is turned off. I'm pretty close to turning this feature back off (via hacked php), which I really don't want to do unless forced to.

          Show
          Michael Woods added a comment - We recently upgraded from 2.3.6 to 2.4.3, so I thought I would leave our site unpatched (ie. allow all Ajax drag drop again), however I've had immediate complaints from multiple staff about resources and sections re-ordering themselves once editing is turned off. I'm pretty close to turning this feature back off (via hacked php), which I really don't want to do unless forced to.
          Hide
          Kristi added a comment -

          I have found that as long as I drag and drop sections on the same screen (without scrolling), it works just fine. This usually means only dragging and dropping up/down one section at a time, and moving larger sections over the smaller ones. Since I have started doing this, I haven't had a problem at all.

          This isn't a solution, but it seems to be a good workaround and it was easy to teach my staff to only drag and drop one section at a time.

          Show
          Kristi added a comment - I have found that as long as I drag and drop sections on the same screen (without scrolling), it works just fine. This usually means only dragging and dropping up/down one section at a time, and moving larger sections over the smaller ones. Since I have started doing this, I haven't had a problem at all. This isn't a solution, but it seems to be a good workaround and it was easy to teach my staff to only drag and drop one section at a time.
          Hide
          Kieran Briggs added a comment -

          Has this been fixed in 2.5 We really love the AJAX features throughout moodle, but if this problem still exists I'm going to have to turn it off.

          Show
          Kieran Briggs added a comment - Has this been fixed in 2.5 We really love the AJAX features throughout moodle, but if this problem still exists I'm going to have to turn it off.
          Hide
          Keith Wilson added a comment - - edited

          No, this is still broken in 2.5. Although it seems as though the random re-ordering might happen a bit less often (although I have not done a rigorous comparison to back this up)

          Show
          Keith Wilson added a comment - - edited No, this is still broken in 2.5. Although it seems as though the random re-ordering might happen a bit less often (although I have not done a rigorous comparison to back this up)
          Hide
          Alexander Kiy added a comment -

          Hi,the problem might be related to MDL-37528. Maybe solving the described AJAX problem will also solve this prob accordingly.

          Show
          Alexander Kiy added a comment - Hi,the problem might be related to MDL-37528 . Maybe solving the described AJAX problem will also solve this prob accordingly.
          Hide
          Stephen Grono added a comment -

          After a bit of digging, I can get topics to move position successfully every time (so far) as long as I keep my mouse INSIDE the topic rectangles while dragging. Move into the white space on the left at all before releasing, or releasing while the mouse is still in this white space, and this is when I'm quickly able to replicate headings jumping around, topics not sticking and similar. I could make this happen on both 2.3 and 2.5 consistently by taking a topic and dragging too far to any side before releasing. Would also fit it only playing up every 4th or so drag.
          Not a whole answer, but seems like a fair clue.

          Like so - so far so good

          Show
          Stephen Grono added a comment - After a bit of digging, I can get topics to move position successfully every time (so far) as long as I keep my mouse INSIDE the topic rectangles while dragging. Move into the white space on the left at all before releasing, or releasing while the mouse is still in this white space, and this is when I'm quickly able to replicate headings jumping around, topics not sticking and similar. I could make this happen on both 2.3 and 2.5 consistently by taking a topic and dragging too far to any side before releasing. Would also fit it only playing up every 4th or so drag. Not a whole answer, but seems like a fair clue. Like so - so far so good
          Hide
          George McBride added a comment -

          Just noted that after a drag and drop, what you see is not always what you get. Refreshing the page shows that the section never was as shown on the screen. Also peculiar, when I drag a section a short distance it "seems" OK; when dragging it a longer distance the screen scrolls the wrong direction. I drag down but the screen scroll upward; I overcome this by using the down arrow key to force the screen down, but after doing this the result is most always wrong after I hit f5 to refresh the page. Version 2.5

          Show
          George McBride added a comment - Just noted that after a drag and drop, what you see is not always what you get. Refreshing the page shows that the section never was as shown on the screen. Also peculiar, when I drag a section a short distance it "seems" OK; when dragging it a longer distance the screen scrolls the wrong direction. I drag down but the screen scroll upward; I overcome this by using the down arrow key to force the screen down, but after doing this the result is most always wrong after I hit f5 to refresh the page. Version 2.5
          Hide
          Paul P added a comment -

          I'd like to point out that this issue has recently celebrated its one year anniversary. With over 60 votes and almost as many watchers, I'm surprised that it still persists. What's really odd is how it rates only a "Minor" priority level. I wish I knew more Ajax so I could help, but I don't, nor am I at all versed in YUI (which I bet is the underlying culprit here).

          If you are reading this and haven't voted yet, then please do so. And better yet, of you know JS/Ajax/YUI, please help

          Show
          Paul P added a comment - I'd like to point out that this issue has recently celebrated its one year anniversary. With over 60 votes and almost as many watchers, I'm surprised that it still persists. What's really odd is how it rates only a "Minor" priority level. I wish I knew more Ajax so I could help, but I don't, nor am I at all versed in YUI (which I bet is the underlying culprit here). If you are reading this and haven't voted yet, then please do so. And better yet, of you know JS/Ajax/YUI, please help
          Hide
          Marina Glancy added a comment -

          Added Javascript component to the issue to attract attention of our JS gurus - as mentioned above there is no error with moving sections when JS off.

          Show
          Marina Glancy added a comment - Added Javascript component to the issue to attract attention of our JS gurus - as mentioned above there is no error with moving sections when JS off.
          Hide
          George McBride added a comment -

          When dragging with the bounds of the screen this seems to work OK. When I drag beyond the window (causing the window to scroll), I pretty much always have errors, it appears to be a problem with the page scrolling (goes the wrong direction). The dragging operation seems OK.

          Show
          George McBride added a comment - When dragging with the bounds of the screen this seems to work OK. When I drag beyond the window (causing the window to scroll), I pretty much always have errors, it appears to be a problem with the page scrolling (goes the wrong direction). The dragging operation seems OK.
          Hide
          Graham Cook added a comment -

          This problem is driving me crazy. I have lost hours of time on it. Please fix!!!

          Show
          Graham Cook added a comment - This problem is driving me crazy. I have lost hours of time on it. Please fix!!!
          Hide
          Colin Campbell added a comment -

          I just added information for a 2.4 git pull that appears to fix this problem (at least as I understand it). It has successfully gone through an initial round of QA testing at our institution. If somebody tries it and finds a problem, please post information about the problem.

          Show
          Colin Campbell added a comment - I just added information for a 2.4 git pull that appears to fix this problem (at least as I understand it). It has successfully gone through an initial round of QA testing at our institution. If somebody tries it and finds a problem, please post information about the problem.
          Hide
          Amy Groshek added a comment -

          Colin Campbell your branch does seem to solve most drag and drop issues. I am still able to on occasion drop a section above the topmost/zero section (should't work). Will do some more testing in the morning.

          Show
          Amy Groshek added a comment - Colin Campbell your branch does seem to solve most drag and drop issues. I am still able to on occasion drop a section above the topmost/zero section (should't work). Will do some more testing in the morning.
          Hide
          Colin Campbell added a comment -

          Hi Amy. Thanks for looking at it. This fix is intended to address only the section reordering bug that results in a different order after refreshing the page. The fix also, incidentally, makes an upward drag far less jerky than it was.

          Show
          Colin Campbell added a comment - Hi Amy. Thanks for looking at it. This fix is intended to address only the section reordering bug that results in a different order after refreshing the page. The fix also, incidentally, makes an upward drag far less jerky than it was.
          Hide
          Michael de Raadt added a comment -

          Giving this a nudge. It looks like it has some backing behind it.

          Show
          Michael de Raadt added a comment - Giving this a nudge. It looks like it has some backing behind it.
          Hide
          Helen Foster added a comment -

          Just noting a recent forum post about this problem: https://moodle.org/mod/forum/discuss.php?d=236585

          Show
          Helen Foster added a comment - Just noting a recent forum post about this problem: https://moodle.org/mod/forum/discuss.php?d=236585
          Hide
          Amy Groshek added a comment -

          Hi Colin Campbell, Before peer review can happen we probably also want branches for 2.5 and 2.6 (2.3 if possible as well). It also looks like your repo is one or two weeks behind Moodle's, will need a rebase. There's a nice script for updating your working repo here: http://docs.moodle.org/dev/Git_for_developers#Keeping_your_public_repository_up-to-date

          Show
          Amy Groshek added a comment - Hi Colin Campbell , Before peer review can happen we probably also want branches for 2.5 and 2.6 (2.3 if possible as well). It also looks like your repo is one or two weeks behind Moodle's, will need a rebase. There's a nice script for updating your working repo here: http://docs.moodle.org/dev/Git_for_developers#Keeping_your_public_repository_up-to-date
          Hide
          Colin Campbell added a comment -

          Hi Amy. I want to be sure I understand this process. When I initially made the commit available, it was on the current 2.4 branch. Are you saying that I should continuously rebase the patch until it is ultimately merged into integration or wherever it gets merged? That's not likely to happen. Also, I am not running either 2.5 or 2.6, so I won't be able to make a tested commit available for those versions.

          By the way, we deployed this change to production last week and has been holding up well.

          Show
          Colin Campbell added a comment - Hi Amy. I want to be sure I understand this process. When I initially made the commit available, it was on the current 2.4 branch. Are you saying that I should continuously rebase the patch until it is ultimately merged into integration or wherever it gets merged? That's not likely to happen. Also, I am not running either 2.5 or 2.6, so I won't be able to make a tested commit available for those versions. By the way, we deployed this change to production last week and has been holding up well.
          Hide
          Amy Groshek added a comment - - edited

          Hi Colin Campbell, Yes, in fact, that's how it works. The integrators can rebase themselves, but it slows down peer review, testing, and integration. If you don't mind, I can cherry-pick your work onto an up-to-date repo and create the necessary branches for all versions, but you won't get credit for the work as it'll come from my repo.

          In my testing the only thing your fix hasn't merged with cleanly is 2.3.

          Show
          Amy Groshek added a comment - - edited Hi Colin Campbell , Yes, in fact, that's how it works. The integrators can rebase themselves, but it slows down peer review, testing, and integration. If you don't mind, I can cherry-pick your work onto an up-to-date repo and create the necessary branches for all versions, but you won't get credit for the work as it'll come from my repo. In my testing the only thing your fix hasn't merged with cleanly is 2.3.
          Hide
          Colin Campbell added a comment -

          Amy. I don't mind not getting credit. I am all for getting the change out more quickly regardless. Thanks.

          Show
          Colin Campbell added a comment - Amy. I don't mind not getting credit. I am all for getting the change out more quickly regardless. Thanks.
          Hide
          Amy Groshek added a comment - - edited

          This fix won't work for 2.3. It only works for YUI3. Do we want to get this fix into peer review and open a new ticket for 2.3?

          Show
          Amy Groshek added a comment - - edited This fix won't work for 2.3. It only works for YUI3. Do we want to get this fix into peer review and open a new ticket for 2.3?
          Hide
          Damyon Wiese added a comment -

          Well - we would not backport this to 2.3 now anyway as it is no longer supported - so no need for the extra branch/different fix.

          1. This change needs testing instructions
          2. The testing instructions for master, should also verify that the keyboard drag and drop is still working.
          3. It is quite hard to review this change to determine what the issue was and how this fix addresses it because there are 0 comments in the patch (and the dnddropcode is quite hard to work with already).

          Coding style:
          We are aiming to improve the standard of our javascript code - one of the ways is by strictly declaring all variables at the top of each function, which this patch does not do.

          To be honest - I don't follow why this fixes the bug. Not to say that it doesn't - but it is too hard to verify without more detail.

          Show
          Damyon Wiese added a comment - Well - we would not backport this to 2.3 now anyway as it is no longer supported - so no need for the extra branch/different fix. 1. This change needs testing instructions 2. The testing instructions for master, should also verify that the keyboard drag and drop is still working. 3. It is quite hard to review this change to determine what the issue was and how this fix addresses it because there are 0 comments in the patch (and the dnddropcode is quite hard to work with already). Coding style: We are aiming to improve the standard of our javascript code - one of the ways is by strictly declaring all variables at the top of each function, which this patch does not do. To be honest - I don't follow why this fixes the bug. Not to say that it doesn't - but it is too hard to verify without more detail.
          Hide
          George McBride added a comment -

          Not to throw a wet rag on things, but has anyone tested this problem in the older version of Moodle with the Newest version of Firefox/Java Script? I find that our Moodle site seems to no longer have this problem! I have not altered Moodle in any way. I have upgraded my local computer and our Host may have upgrade some of the underlying OS/softare. But the drag an drop seems to work for me now. I have no explanation; just think a look back might be called for before spending more time on this.
          Moodle 2.5.1+ (Build: 20130830) Version 2013051401.12

          Show
          George McBride added a comment - Not to throw a wet rag on things, but has anyone tested this problem in the older version of Moodle with the Newest version of Firefox/Java Script? I find that our Moodle site seems to no longer have this problem! I have not altered Moodle in any way. I have upgraded my local computer and our Host may have upgrade some of the underlying OS/softare. But the drag an drop seems to work for me now. I have no explanation; just think a look back might be called for before spending more time on this. Moodle 2.5.1+ (Build: 20130830) Version 2013051401.12
          Hide
          Colin Campbell added a comment -

          The call to Y.DD.DDM.syncActiveShims just after moving the node with insertBefore (lib/yui/dragdrop/dragdrop.js) is necessary to keep the shim regions in sync with the UI. Without this change, the YUI3 logic gets confused as to which element is being dragged over. That is especially apparent after dragging down a few elements and then slowly dragging back up. You can see lots of jumping back and forth due to the wrong element being identified as the drag-over element.

          The changes in course/yui/dragdrop/dragdrop.js that result in ignoring the drop node are necessary because the node identified as the drop node is the same as the drag node. It is the same because the design has the node being dragged following the cursor.

          (By the way, I just noticed that the old "var dropnode = e.drop.get('node');" in course/yui/dragdrop/dragdrop.js can be deleted.)

          Show
          Colin Campbell added a comment - The call to Y.DD.DDM.syncActiveShims just after moving the node with insertBefore (lib/yui/dragdrop/dragdrop.js) is necessary to keep the shim regions in sync with the UI. Without this change, the YUI3 logic gets confused as to which element is being dragged over. That is especially apparent after dragging down a few elements and then slowly dragging back up. You can see lots of jumping back and forth due to the wrong element being identified as the drag-over element. The changes in course/yui/dragdrop/dragdrop.js that result in ignoring the drop node are necessary because the node identified as the drop node is the same as the drag node. It is the same because the design has the node being dragged following the cursor. (By the way, I just noticed that the old "var dropnode = e.drop.get('node');" in course/yui/dragdrop/dragdrop.js can be deleted.)
          Hide
          Amy Groshek added a comment -

          2.3 is, based on my testing, decidedly the worst. 2.4 and 2.5 are much more stable, and do not seem to have the random reordering issues of 2.3. The main issues on 2.4 and 2.5 seem to be:

          1. Drag started quickly does not engage lightbox
          2. Sections can be dropped above zero block

          I'm unassigning this and removing my repo from the ticket. New tasks for what I've listed above might be a good idea, but based on Daymon's comments above, there's no reason to attempt to shepherd this through any longer.

          Show
          Amy Groshek added a comment - 2.3 is, based on my testing, decidedly the worst. 2.4 and 2.5 are much more stable, and do not seem to have the random reordering issues of 2.3. The main issues on 2.4 and 2.5 seem to be: Drag started quickly does not engage lightbox Sections can be dropped above zero block I'm unassigning this and removing my repo from the ticket. New tasks for what I've listed above might be a good idea, but based on Daymon's comments above, there's no reason to attempt to shepherd this through any longer.
          Hide
          Cathal O'Riordan added a comment -

          So where does that leave this problem then? Is it no longer a legitimate bug?

          Show
          Cathal O'Riordan added a comment - So where does that leave this problem then? Is it no longer a legitimate bug?
          Hide
          Martin Dougiamas added a comment -

          We will have someone look into this and try to ascertain exactly when it's a problem. The code in this area has had many changes in recent major releases.

          Show
          Martin Dougiamas added a comment - We will have someone look into this and try to ascertain exactly when it's a problem. The code in this area has had many changes in recent major releases.
          Hide
          Adam Salem added a comment -

          Maybe related to this issue, when I am reordering topics in a course on our Moodle 2.5 site the topics randomly reorder themselves when editing is turned off.

          Shall I log this as a new bug item and supply screenshots or is this related to this bug?

          Show
          Adam Salem added a comment - Maybe related to this issue, when I am reordering topics in a course on our Moodle 2.5 site the topics randomly reorder themselves when editing is turned off. Shall I log this as a new bug item and supply screenshots or is this related to this bug?
          Hide
          Colin Campbell added a comment -

          Adam - That is the same problem that our institution was having until I applied the patch that I submitted for this ticket in August. We are on 2.4, but the same patch might also work for 2.5.

          Show
          Colin Campbell added a comment - Adam - That is the same problem that our institution was having until I applied the patch that I submitted for this ticket in August. We are on 2.4, but the same patch might also work for 2.5.
          Hide
          Adam Salem added a comment -

          Hi Colin, I can't seem to find reference to your specific patch on this issue? The only linked repo is Amy Groshek's which contains all sorts of stuff. Do you have a diff for your patch?

          Show
          Adam Salem added a comment - Hi Colin, I can't seem to find reference to your specific patch on this issue? The only linked repo is Amy Groshek's which contains all sorts of stuff. Do you have a diff for your patch?
          Hide
          Colin Campbell added a comment -

          Adam - My patch is available if you view history, but I believe Amy created patches for the other branches from my patch. So they should have the same changes.

          Show
          Colin Campbell added a comment - Adam - My patch is available if you view history, but I believe Amy created patches for the other branches from my patch. So they should have the same changes.
          Hide
          Andrew Nicols added a comment -

          All,

          I'm going to try and track down this issue but I could do with some additional information and, if possible, some testing to try and track it down. At present I'm unable to replicate this issue using the current instructions suggested, so if there are some more specific instructions that would be great to know about.

          There was an issue affecting all section moving (both with and without JavaScript):

          • issue: MDL-37939
          • affects 2.3, 2.4
          • fixed in 2.3.5, 2.4.2

          I also fixed an issue last week relating to dropping sections on the zero section:

          • issue: MDL-36465
          • affects 2.3, 2.5, 2.5
          • fixed in 2.4.7, 2.5.3

          I've not been able to replicate any issues with dropping the section out to the side.
          I've also been unable to replicate any issue with the section moving between refreshes when the DD.Scroll is active, though I've seen the shim appearing slightly in the wrong place from time to time after a scroll. It still does work as expected when it's dropped in place - it just appears slightly high or low sometimes.

          So, in summary, it would be really helpful to know:

          • versions for those still affected
          • when you see the issue
          • if you can apply the fix in MDL-36465 and test again, do you still see the issue; or (less preferable)
            • if you can just try hard to avoid the zero section (general) do you see the issue?

          Additinally, if someone is able to create a short screencast to demonstrate the issue that would be particularly helpful (with affected version and whether MDL-36465 is applied).

          Thanks in advance,

          Andrew

          Show
          Andrew Nicols added a comment - All, I'm going to try and track down this issue but I could do with some additional information and, if possible, some testing to try and track it down. At present I'm unable to replicate this issue using the current instructions suggested, so if there are some more specific instructions that would be great to know about. There was an issue affecting all section moving (both with and without JavaScript): issue: MDL-37939 affects 2.3, 2.4 fixed in 2.3.5, 2.4.2 I also fixed an issue last week relating to dropping sections on the zero section: issue: MDL-36465 affects 2.3, 2.5, 2.5 fixed in 2.4.7, 2.5.3 I've not been able to replicate any issues with dropping the section out to the side. I've also been unable to replicate any issue with the section moving between refreshes when the DD.Scroll is active, though I've seen the shim appearing slightly in the wrong place from time to time after a scroll. It still does work as expected when it's dropped in place - it just appears slightly high or low sometimes. So, in summary, it would be really helpful to know: versions for those still affected when you see the issue if you can apply the fix in MDL-36465 and test again, do you still see the issue; or (less preferable) if you can just try hard to avoid the zero section (general) do you see the issue? Additinally, if someone is able to create a short screencast to demonstrate the issue that would be particularly helpful (with affected version and whether MDL-36465 is applied). Thanks in advance, Andrew
          Hide
          Marina Glancy added a comment -

          Andrew, it can be reproduced on all branches including integration (MDL-36465 is not related).

          1. Drag a first section one section below, drop it. In JS console you will see an AJAX request to rest.php with id=1 and value=2, meaning that first section is dragged into the place of second section. Everything is fine.
          2. Drag a first section one section below but do not drop it, just drag back to it's place and drop. In JS console you will see an AJAX request to rest.php with id=1 and value=2 (just like in the previous case), so server thinks that section is moved and sends back new values for headers. But for the user on the screen the section contents is not moved, all user can see is swapped headers. If you refresh you can see that first section was actually moved.

          So the problem is somewhere in dragdrop javascript but I can't understand what is going on here. The most of JS code is coming from MDL-31052 so hopefully you or Ruslan Kabalin can best fix it.

          My guess is that still the same code is used for resources moving, some logic from there was borrowed. But in case of activities we send to the rest.php the id of the NEXT activity and in case of section - the sectionnumber of the target position... But in this case - why does it work fine when you drag a section to the new position?

          Show
          Marina Glancy added a comment - Andrew, it can be reproduced on all branches including integration ( MDL-36465 is not related). Drag a first section one section below, drop it. In JS console you will see an AJAX request to rest.php with id=1 and value=2, meaning that first section is dragged into the place of second section. Everything is fine. Drag a first section one section below but do not drop it, just drag back to it's place and drop. In JS console you will see an AJAX request to rest.php with id=1 and value=2 (just like in the previous case), so server thinks that section is moved and sends back new values for headers. But for the user on the screen the section contents is not moved, all user can see is swapped headers. If you refresh you can see that first section was actually moved. So the problem is somewhere in dragdrop javascript but I can't understand what is going on here. The most of JS code is coming from MDL-31052 so hopefully you or Ruslan Kabalin can best fix it. My guess is that still the same code is used for resources moving, some logic from there was borrowed. But in case of activities we send to the rest.php the id of the NEXT activity and in case of section - the sectionnumber of the target position... But in this case - why does it work fine when you drag a section to the new position?
          Hide
          Marina Glancy added a comment -

          And I attach the backup file for the convenient course to test on - it has 10 sections with names A, B, C, ... and each has a label with the name A, B, C, .... So when title gets unsynchronised with the content it is easy to see

          Show
          Marina Glancy added a comment - And I attach the backup file for the convenient course to test on - it has 10 sections with names A, B, C, ... and each has a label with the name A, B, C, .... So when title gets unsynchronised with the content it is easy to see
          Hide
          Marina Glancy added a comment -

          I found it!

          diff --git a/course/yui/dragdrop/dragdrop.js b/course/yui/dragdrop/dragdrop.js
          index 801ffc9..f7a2d9a 100644
          --- a/course/yui/dragdrop/dragdrop.js
          +++ b/course/yui/dragdrop/dragdrop.js
          @@ -130,7 +130,6 @@ YUI.add('moodle-course-dragdrop', function(Y) {
                       // Missed the target, but we assume the user intended to drop it
                       // on the last last ghost node location, e.drag and e.drop should be
                       // prepared by global_drag_dropmiss parent so simulate drop_hit(e).
          -            this.drop_hit(e);
                   },
           
                   drop_hit : function(e) {
          

          Now the question - WHY do we call drop_hit() when we miss? Ruslan Kabalin can you explain it please?
          https://github.com/moodle/moodle/commit/243e9bf9

          Show
          Marina Glancy added a comment - I found it! diff --git a/course/yui/dragdrop/dragdrop.js b/course/yui/dragdrop/dragdrop.js index 801ffc9..f7a2d9a 100644 --- a/course/yui/dragdrop/dragdrop.js +++ b/course/yui/dragdrop/dragdrop.js @@ -130,7 +130,6 @@ YUI.add('moodle-course-dragdrop', function(Y) { // Missed the target, but we assume the user intended to drop it // on the last last ghost node location, e.drag and e.drop should be // prepared by global_drag_dropmiss parent so simulate drop_hit(e). - this .drop_hit(e); }, drop_hit : function(e) { Now the question - WHY do we call drop_hit() when we miss? Ruslan Kabalin can you explain it please? https://github.com/moodle/moodle/commit/243e9bf9
          Hide
          Andrew Nicols added a comment -

          I suspect this may be because the user is not quite over the target but there was still a ghost? I'm not entirely sure myself. Hopefully Ruslan Kabalin can remember?

          Show
          Andrew Nicols added a comment - I suspect this may be because the user is not quite over the target but there was still a ghost? I'm not entirely sure myself. Hopefully Ruslan Kabalin can remember?
          Hide
          Ruslan Kabalin added a comment - - edited

          Of course I remember This came from MDL-32752. When user releases the mouse button exactly over the target, the moving section will appear exactly where ghost is shown. Users normally release button over target on section that are located between others, this is, however, not always the case for edge sections (top and bottom). In case of top and bottom sections (or resources), user may drag mouse with button pressed far above target (for top element) or far below it (for bottom one), and the ghost will still be shown at the right place (top or bottom), but the target will be missed if mouse button is released, despite the fact that ghost section is in the correct place. So, on mouse release, the section move will not be recorded, which will be confusing for user as ghost section had correct location prior button release. There is a video demonstrating above at MDL-32752.

          That bit in the code just ensures that element is dropped at the current ghost section/resourse location, no matter if mouse cursor above the target or outside its border.

          Show
          Ruslan Kabalin added a comment - - edited Of course I remember This came from MDL-32752 . When user releases the mouse button exactly over the target, the moving section will appear exactly where ghost is shown. Users normally release button over target on section that are located between others, this is, however, not always the case for edge sections (top and bottom). In case of top and bottom sections (or resources), user may drag mouse with button pressed far above target (for top element) or far below it (for bottom one), and the ghost will still be shown at the right place (top or bottom), but the target will be missed if mouse button is released, despite the fact that ghost section is in the correct place. So, on mouse release, the section move will not be recorded, which will be confusing for user as ghost section had correct location prior button release. There is a video demonstrating above at MDL-32752 . That bit in the code just ensures that element is dropped at the current ghost section/resourse location, no matter if mouse cursor above the target or outside its border.
          Hide
          Colin Campbell added a comment -

          My fix, which I explained above, is to call Y.DD.DDM.syncActiveShims() in global_drop_over immediately after the insertBefore() call that moves the element. Also, in drop_hit (in moodle/course/yui/dragdrop/dragdrop.js), we can't rely on e.drop; it's probably not the right element. So, my fix gets the drop location from the item that we have been dragging around anyway. Since the Javascript is constantly moving it around as we drag it, we can just drop it in its currently dragged location.

          We have had no user complaints on this issue since deploying the fix.

          Show
          Colin Campbell added a comment - My fix, which I explained above, is to call Y.DD.DDM.syncActiveShims() in global_drop_over immediately after the insertBefore() call that moves the element. Also, in drop_hit (in moodle/course/yui/dragdrop/dragdrop.js), we can't rely on e.drop; it's probably not the right element. So, my fix gets the drop location from the item that we have been dragging around anyway. Since the Javascript is constantly moving it around as we drag it, we can just drop it in its currently dragged location. We have had no user complaints on this issue since deploying the fix.
          Hide
          Marina Glancy added a comment -

          Hi Colin, thanks! I looked through the history and found your branch. No idea why it was deleted from this issue:
          https://github.com/colin-umn/moodle/commit/0de3c35fcb4a334c882758fc73e9776eb6884ee8
          We might need to amend it a little before integrating but I'm sure it is going in the right direction

          Show
          Marina Glancy added a comment - Hi Colin, thanks! I looked through the history and found your branch. No idea why it was deleted from this issue: https://github.com/colin-umn/moodle/commit/0de3c35fcb4a334c882758fc73e9776eb6884ee8 We might need to amend it a little before integrating but I'm sure it is going in the right direction
          Hide
          Michael de Raadt added a comment -

          Andrew asked me to comment on what I am seeing in the current master when reordering sections. It may be a distinct issue from the one reported originally here.

          Most of the time section moving works, but occasionally after shifting sections a few times without refreshing, when I shift a section, the section title is updated, but the section content (activities and resources) get left behind. The result is the screen capture I have attached. In that screen capture the content shown in the Topic 3 section should have been shifted to the section above. After refreshing, the content is shown in the correct place.

          I don't know if it is the cause, but there are empty sections in my course and a mix of sections that are automatically named and some that are manually named.

          Show
          Michael de Raadt added a comment - Andrew asked me to comment on what I am seeing in the current master when reordering sections. It may be a distinct issue from the one reported originally here. Most of the time section moving works, but occasionally after shifting sections a few times without refreshing, when I shift a section, the section title is updated, but the section content (activities and resources) get left behind. The result is the screen capture I have attached. In that screen capture the content shown in the Topic 3 section should have been shifted to the section above. After refreshing, the content is shown in the correct place. I don't know if it is the cause, but there are empty sections in my course and a mix of sections that are automatically named and some that are manually named.
          Hide
          Kristi added a comment -

          This is the work around I currently have my staff using. It seems to work 100% of the time.

          1. Only move blocks within what you can see on the screen without scrolling (either zoom out a lot, or only move them up/down a couple blocks at a time).
          2. Refresh the page between every move.

          (Repeat as many times as you need to move the block where you want it.)

          Show
          Kristi added a comment - This is the work around I currently have my staff using. It seems to work 100% of the time. 1. Only move blocks within what you can see on the screen without scrolling (either zoom out a lot, or only move them up/down a couple blocks at a time). 2. Refresh the page between every move. (Repeat as many times as you need to move the block where you want it.)
          Hide
          Michael de Raadt added a comment -

          Carrying over to the next sprint

          Show
          Michael de Raadt added a comment - Carrying over to the next sprint
          Hide
          Andrew Nicols added a comment -

          I'm still unable to replicate this despite having tried a variety of ways of moving the sections.

          I'll keep trying while I work on another issue in this area, and failing that I'll see if someone else in the office can replicate.

          Show
          Andrew Nicols added a comment - I'm still unable to replicate this despite having tried a variety of ways of moving the sections. I'll keep trying while I work on another issue in this area, and failing that I'll see if someone else in the office can replicate.
          Hide
          Andrew Nicols added a comment -

          Ah - I've finally been able to replicate this.

          Show
          Andrew Nicols added a comment - Ah - I've finally been able to replicate this.
          Hide
          Andrew Nicols added a comment -

          Okay, so I'm not seeing Y.DDM.syncActiveShims() fix this I'm afraid.
          The rest of Colin's commit was fixing the zero-index issue which has now been resolved in another issue.

          It looks like the drag proxy is displaying the correct information, but upon dropping the node is not dragged.
          It also isn't limited to when you've done a few moves. I've managed to replicate this on first time moves too.

          I think I've got this to repeatedly fail when you:

          • start dragging the top section
          • move it down to the next section
          • move it down a little further so it's now swapping with section 3
          • now move it back to back to swap it with section 2
          • now stop dragging

          It looks like it's the goingup logic breaking somewhere.

          Show
          Andrew Nicols added a comment - Okay, so I'm not seeing Y.DDM.syncActiveShims() fix this I'm afraid. The rest of Colin's commit was fixing the zero-index issue which has now been resolved in another issue. It looks like the drag proxy is displaying the correct information, but upon dropping the node is not dragged. It also isn't limited to when you've done a few moves. I've managed to replicate this on first time moves too. I think I've got this to repeatedly fail when you: start dragging the top section move it down to the next section move it down a little further so it's now swapping with section 3 now move it back to back to swap it with section 2 now stop dragging It looks like it's the goingup logic breaking somewhere.
          Hide
          Steve Bailey added a comment -

          Just wanted to add that we're experiencing this in 2.4.6 (Build: 20130909). Let me know if you need any more info on that.

          Show
          Steve Bailey added a comment - Just wanted to add that we're experiencing this in 2.4.6 (Build: 20130909). Let me know if you need any more info on that.
          Hide
          Patrick Mulvany added a comment -

          FYI We appear to have users experiencing these symptoms on Moodle 2.4.6.
          Not sure if this is the same issue of a related one.

          Show
          Patrick Mulvany added a comment - FYI We appear to have users experiencing these symptoms on Moodle 2.4.6. Not sure if this is the same issue of a related one.
          Hide
          Andrew Nicols added a comment -

          Thanks both,

          I think I've tracked this down and intend to work on the fix tomorrow for all stable versions.

          Andrew

          Show
          Andrew Nicols added a comment - Thanks both, I think I've tracked this down and intend to work on the fix tomorrow for all stable versions. Andrew
          Hide
          Marina Glancy added a comment -

          Andrew, look at Colin's branch (it was erased from the issue but I repeated it in my comment above). It seems to be addressing the right things.

          Show
          Marina Glancy added a comment - Andrew, look at Colin's branch (it was erased from the issue but I repeated it in my comment above). It seems to be addressing the right things.
          Hide
          Andrew Nicols added a comment -

          I have a fix - just tidying it up now. It's quite extensive but really tidies up a lot of things.

          Essentially, the issues boil down to:

          • goingup/goingdown is relative not absolute;
          • the wrong drop index is used;
          • bubble method to update the section IDs is unnecessary - they should always be consecutive from 1. The reorder_sections() PHP assumes this and does not use the same sorting method as the JS so there's potential for breakage - they should match.

          I've taken the relevant part of Colin's fix and tidied it up, improved and simplified the goingup/goingdown code, and made the section sorting changes (JS) match what happens in PHP.

          Show
          Andrew Nicols added a comment - I have a fix - just tidying it up now. It's quite extensive but really tidies up a lot of things. Essentially, the issues boil down to: goingup/goingdown is relative not absolute; the wrong drop index is used; bubble method to update the section IDs is unnecessary - they should always be consecutive from 1. The reorder_sections() PHP assumes this and does not use the same sorting method as the JS so there's potential for breakage - they should match. I've taken the relevant part of Colin's fix and tidied it up, improved and simplified the goingup/goingdown code, and made the section sorting changes (JS) match what happens in PHP.
          Hide
          Andrew Nicols added a comment -

          This will need some backport branches too - I'll work on those tomorrow. I'll submit the linting fixes to master only.

          Any chance of a peer review someone?

          Show
          Andrew Nicols added a comment - This will need some backport branches too - I'll work on those tomorrow. I'll submit the linting fixes to master only. Any chance of a peer review someone?
          Hide
          Ruslan Kabalin added a comment - - edited

          With regard to bubble sort, the purpose of it is to sort sections between dragged and destination nodes, it triggers M.course.format.swap_sections on each move. Reason for that - section titles might be something different from numbers and require to be in right order after section is dragged to the new location (e.g. weekly format requires that).

          Show
          Ruslan Kabalin added a comment - - edited With regard to bubble sort, the purpose of it is to sort sections between dragged and destination nodes, it triggers M.course.format.swap_sections on each move. Reason for that - section titles might be something different from numbers and require to be in right order after section is dragged to the new location (e.g. weekly format requires that).
          Hide
          Steve Bailey added a comment -

          Thanks Andrew. Just tested this on 2.4 and it appears to fix the issue, but section titles don't change until you refresh the page. I assume that's unexpected? Or perhaps because the fix is designed for 2.5?

          Show
          Steve Bailey added a comment - Thanks Andrew. Just tested this on 2.4 and it appears to fix the issue, but section titles don't change until you refresh the page. I assume that's unexpected? Or perhaps because the fix is designed for 2.5?
          Hide
          Andrew Nicols added a comment -

          Thanks Steve Bailey, I'd made a mistake when fixing a few issues and had committed the mistake. Try now?

          Ruslan Kabalin, the bubble sort is separate to the course formats. That happened before the bubble sort.

          I've just tried on topic + week formats.

          Show
          Andrew Nicols added a comment - Thanks Steve Bailey , I'd made a mistake when fixing a few issues and had committed the mistake. Try now? Ruslan Kabalin , the bubble sort is separate to the course formats. That happened before the bubble sort. I've just tried on topic + week formats.
          Hide
          Andrew Nicols added a comment -

          Ah Ruslan Kabalin, looking again at the code when it's not late evening, I see that I've taken out a call for:

          M.course.format.swap_sections(Y, i-1, i);
          

          as part of the bubble sort change. Although this isn't used for switching the titles, it could be used by some course formats to change other aspects about the format as a whole.

          I'll look at adding back the bubbling, or at least part of it.

          Show
          Andrew Nicols added a comment - Ah Ruslan Kabalin , looking again at the code when it's not late evening, I see that I've taken out a call for: M.course.format.swap_sections(Y, i-1, i); as part of the bubble sort change. Although this isn't used for switching the titles, it could be used by some course formats to change other aspects about the format as a whole. I'll look at adding back the bubbling, or at least part of it.
          Hide
          Andrew Nicols added a comment -

          And I've pushed a new version of the patch with the bubble back but tided up a little to correct variable scoping issues.

          Show
          Andrew Nicols added a comment - And I've pushed a new version of the patch with the bubble back but tided up a little to correct variable scoping issues.
          Hide
          Andrew Nicols added a comment -

          I'm going to submit this for integration as I've been unable to get a peer review for it for just under a week.

          Show
          Andrew Nicols added a comment - I'm going to submit this for integration as I've been unable to get a peer review for it for just under a week.
          Hide
          Ruslan Kabalin added a comment -

          Since you already submitted for integration, I will not be doing a formal review (intended originally, but thought Damyon will be disappointed). The code looks fine to me.

          Show
          Ruslan Kabalin added a comment - Since you already submitted for integration, I will not be doing a formal review (intended originally, but thought Damyon will be disappointed). The code looks fine to me.
          Hide
          Andrew Nicols added a comment -

          If you have time Ruslan, I'd really appreciate an extra set of eyes. I can move it back to PR stage.

          Show
          Andrew Nicols added a comment - If you have time Ruslan, I'd really appreciate an extra set of eyes. I can move it back to PR stage.
          Hide
          Damyon Wiese added a comment -

          Suggest we change the Peer review to Ruslan then (I haven't reviewed this patch - I reviewed a version of it weeks ago).

          Show
          Damyon Wiese added a comment - Suggest we change the Peer review to Ruslan then (I haven't reviewed this patch - I reviewed a version of it weeks ago).
          Hide
          Ruslan Kabalin added a comment -

          Andrew Nicols yep, please move to PR stage.
          Damyon Wiese OK, I have changed reviewer to myself now.

          Show
          Ruslan Kabalin added a comment - Andrew Nicols yep, please move to PR stage. Damyon Wiese OK, I have changed reviewer to myself now.
          Hide
          Ruslan Kabalin added a comment - - edited

          [Y] Syntax
          [Y] Whitespace
          [X] Output
          [X] Language
          [X] Databases
          [N] Testing
          [X] Security
          [X] Documentation
          [Y] Git
          [X] Third party code
          [Y] Sanity check

          Testing instruction is missing in the ticket.

          Show
          Ruslan Kabalin added a comment - - edited [Y] Syntax [Y] Whitespace [X] Output [X] Language [X] Databases [N] Testing [X] Security [X] Documentation [Y] Git [X] Third party code [Y] Sanity check Testing instruction is missing in the ticket.
          Hide
          Dan Poltawski added a comment -

          The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week.

          TIA and ciao

          Show
          Dan Poltawski added a comment - The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week. TIA and ciao
          Hide
          Dan Poltawski added a comment -

          This bug was reported on stable versions and has 117 votes - how come the fix here is only for master?

          Show
          Dan Poltawski added a comment - This bug was reported on stable versions and has 117 votes - how come the fix here is only for master?
          Hide
          Andrew Nicols added a comment -

          Apologies for that Dan Poltawski,

          This got delayed in Peer Review for some time and I forgot to produce the branches as a result.

          These are pushed (and tested) now.

          Andrew

          Show
          Andrew Nicols added a comment - Apologies for that Dan Poltawski , This got delayed in Peer Review for some time and I forgot to produce the branches as a result. These are pushed (and tested) now. Andrew
          Hide
          Dan Poltawski added a comment -

          Integrated to master, 25 and 24 - thanks Andrew.

          Hopefully testing will show this change to be good

          Show
          Dan Poltawski added a comment - Integrated to master, 25 and 24 - thanks Andrew. Hopefully testing will show this change to be good
          Hide
          Rajesh Taneja added a comment -

          Thanks for fixing this Andrew, mostly works fine...

          One edge-case found and will open another issue for it.

          1. Dragging first section above section-0 moves it to section-2
            • Drag section-2 above section-1 and now it's section-1
            • Drag section-1 above section-0 and it becomes section-2
              Similar issue is present for last section being dragged

          Also, it might be nice to have a way to cancel d-n-d, but that is another issue for sure.

          Passing this...

          Show
          Rajesh Taneja added a comment - Thanks for fixing this Andrew, mostly works fine... One edge-case found and will open another issue for it. Dragging first section above section-0 moves it to section-2 Drag section-2 above section-1 and now it's section-1 Drag section-1 above section-0 and it becomes section-2 Similar issue is present for last section being dragged Also, it might be nice to have a way to cancel d-n-d, but that is another issue for sure. Passing this...
          Hide
          Andrew Nicols added a comment -

          Thanks Raj,

          As discussed IRL, I think that it's probably still best to pass this issue as it still improves the current status quo and changes reflected in the display after preserved between reloads.

          Looking at the cause now.

          Show
          Andrew Nicols added a comment - Thanks Raj, As discussed IRL, I think that it's probably still best to pass this issue as it still improves the current status quo and changes reflected in the display after preserved between reloads. Looking at the cause now.
          Hide
          Andrew Nicols added a comment -

          Unable to replicate this issue... Raj is looking to confirm.

          Show
          Andrew Nicols added a comment - Unable to replicate this issue... Raj is looking to confirm.
          Hide
          Rajesh Taneja added a comment -

          Sorry guys ... section movement is working fine...

          Show
          Rajesh Taneja added a comment - Sorry guys ... section movement is working fine...
          Hide
          Eloy Lafuente (stronk7) added a comment -

          "Aequam memento rebus in arduis servare mentem"

          Many thanks for your hard work, this is now part of "Moodle, the LMS". Closing!

          Ciao

          Show
          Eloy Lafuente (stronk7) added a comment - "Aequam memento rebus in arduis servare mentem" Many thanks for your hard work, this is now part of "Moodle, the LMS". Closing! Ciao
          Hide
          Michael Woods added a comment -

          Having just applied this fix in the latest 2.4.6 upgrade, we can no longer drag Section 1 anywhere. We can drag Section 2 up (effectively shifting Section 1 down), but Section 1 can't be moved by dragging it. Can anyone else confirm this behaviour?

          Show
          Michael Woods added a comment - Having just applied this fix in the latest 2.4.6 upgrade, we can no longer drag Section 1 anywhere . We can drag Section 2 up (effectively shifting Section 1 down), but Section 1 can't be moved by dragging it. Can anyone else confirm this behaviour?
          Hide
          Michael Woods added a comment -

          In fact, dragging any section down is problematic now. Dragging a section up appears to be working fine.

          Show
          Michael Woods added a comment - In fact, dragging any section down is problematic now. Dragging a section up appears to be working fine.
          Hide
          Andrew Nicols added a comment -

          Michael Woods, can you confirm how you have applied this patch, and whether you've also applied MDL-36465 beforehand?

          Show
          Andrew Nicols added a comment - Michael Woods , can you confirm how you have applied this patch, and whether you've also applied MDL-36465 beforehand?
          Hide
          Michael Woods added a comment -

          Hi Andrew,

          This was applied by a full site upgrade to the latest weekly release via git. I upgraded from the previous weekly release, so I assume we already had MDL-36465 applied.

          I'll try and do some more testing, but initial tests were using latest Chrome browser.

          Thanks
          Michael

          Show
          Michael Woods added a comment - Hi Andrew, This was applied by a full site upgrade to the latest weekly release via git. I upgraded from the previous weekly release, so I assume we already had MDL-36465 applied. I'll try and do some more testing, but initial tests were using latest Chrome browser. Thanks Michael

            Dates

            • Created:
              Updated:
              Resolved:

              Agile