forms
forms copied to clipboard
feat: Allow to reorder options of "checkbox" "radio" and "dropdown" question types in frontend
- Resolves https://github.com/nextcloud/forms/issues/354
This adds support to reorder options instead of having to remove them. It works but I had to modify a lot of places to keep smooth behavior of the list ordering.
Implementation things:
- I am not sure about the API endpoint, it does not match our current naming style
- Should we expose the "order" property or just keep it internally and only return options sorted?
@nextcloud/designers question:
- There is not much space for a "drag" handle + a11y button so I just used buttons, I do not think it looks super awesome, but it works. Do you have an idea how to improve? Especially because there is already the drag handle for the question itself.
Screenshots
| Shuffle options enabled = no sorting | No shuffle = you can sort |
|---|---|
- There is not much space for a "drag" handle + a11y button so I just used buttons, I do not think it looks super awesome, but it works. Do you have an idea how to improve? Especially because there is already the drag handle for the question itself.
I think it looks fine but had one suggestion :)
drag handle that on click/enter shows a menu saying "Move up" and "Move down"
@jancborchardt This would on the other hand introduce one more click for every move operation...
- Should the drag handle be on left or right – I would tend towards left
having the handle on the left would introduce one more difference between edit and view mode, but we already have some differences, so I'd be fine with that. Whatever looks better as a whole.
The problem with a drag handle on the left is the conflict with the drag handle for the question itself. We would then have two drag handles next to each other. Not sure about that.
@susnux @jancborchardt What about having the arrow icons as an overlay at the end of the input fields that only shows up when the field has the focus / hover?
@susnux should I add your backend code to the API v3 PR or would you like to keep it in here and adjust it after v3 merge?
adjust it after v3 merge?
will adjust afterwards :)