Lesterhuis-Training-en-Consultancy / moodle-block-user_favorites

Moodle plugin - marking pages as favorites
GNU General Public License v3.0
1 stars 4 forks source link

replaces JqueryUI-based drag/drop with Moodle-specific core/sortable_list JS component #17

Closed stopfstedt closed 1 year ago

stopfstedt commented 1 year ago

fixes #16

ditching jQuery UI in favor of Moodle's home-grown code for drag/drop lists solves this issue.

it also has the added benefit of increased accessibility (clicking on the "drag" icon brings up a modal that can be used as an alternative means to move favorites around in the list).

for reference, please see

https://tracker.moodle.org/browse/MDL-51803 https://github.com/moodle/moodle/blob/master/lib/amd/src/sortable_list.js https://github.com/moodle/moodle/blob/master/customfield/amd/src/form.js#L187 https://docs.moodle.org/dev/Sortable_list

CAVEAT: please note that this JS component has been available in Moodle since version 3.6, so this will break backwards compatibility with older versions (seems like the current baseline is Moodle 3.4).

stopfstedt commented 1 year ago

tested against Moodle 4.1 so far, will kick it around in older versions first before changing this to "Ready for review".

stopfstedt commented 1 year ago

made a few tweaks, and tested this across various Moodle versions.

this change holds up in Moodle 3.8, 3.9, 3.10, 3.11, 4.0, and 4.1.

the plugin doesn't work in Moodle 3.7 and older out of the box (would require an older version of npm/grunt for compilation), and it doesn't work with Moodle 4.2 yet due to unrelated backend API changes.

in any case, this is ready for review.