I agree with Andrew, there might be themes that does not support dragdrop, to removing these buttons for them initially will be a shame.
Yes, I had some thoughts about this. What is missed in Moodle, is the way to determine if JS is actually enabled/supported by browser. We use the code that degrades nicely, which is good, but not sufficient in the cases like above.
The approach here could be to actually make browser informing server if it can handle JS. The flow of this process could be:
- On first Moodle page load. The renderer adds the js snippet that does ajax callback and refresh the page on success.
- The back-end which fetches ajax request, sets $SESSION->browserjsenabled = true;
- $SESSION->browserjsenabled can be used everywhere for checking that browser uses JS (e.g. in renderer for moveup/movedown buttons generation)
- If $SESSION->browserjsenabled has been set, renderer does not produce a callback snippet before session is expired again.
- Adds testing difficulties, turning JS off in the browser which informed Moodle that JS is enabled will not bring desired result. Moodle will still think that JS enabled. Hmm, actually this can be solved by having <noscript> with
to reset $SESSION->browserjsenabled when browser stopped supporting JS all of a sudden.
<meta http-equiv="refresh" content="0; URL=index.php?nojs">
- May make people relying on this rather than producing a good degradable code.