Creating sortable menu items
The menu widget, by default, preserves the order of the listed elements used to create the menu items. It means that if the creator of the HTML used in the menu widget were to change the ordering, this would be reflected in the rendered menu. This is good for the developers because it gives us control over how we would like the items to be presented to the user. But, perhaps the user has a better idea on how the menu items should be ordered.
By combining the menu widget with the sortable interaction widget, we can provide the user with that flexibility. However, with this new capability, we will have to address another question; preserving the order chosen by the user. It is great if they can arrange the menu items how they see fit, but it is not so great if they have to repeat the same process every time the page loads. So we'll look, as well, at preserving the sorted menu order in a cookie.
Getting ready
Let's use the following HTML code for our menu widget. This...