forms icon indicating copy to clipboard operation
forms copied to clipboard

feat: Allow to reorder options of "checkbox" "radio" and "dropdown" question types in frontend

Open susnux opened this issue 1 year ago • 5 comments

  • 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
Screenshot 2024-04-22 at 12-31-10 fff9 - Forms - Nextcloud Screenshot 2024-04-22 at 12-31-51 fff9 - Forms - Nextcloud

susnux avatar Apr 22 '24 10:04 susnux

  • 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 :)

szaimen avatar Apr 22 '24 11:04 szaimen

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.

Chartman123 avatar Apr 22 '24 14:04 Chartman123

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 avatar Apr 23 '24 08:04 susnux

@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?

Chartman123 avatar Aug 09 '24 10:08 Chartman123

adjust it after v3 merge?

will adjust afterwards :)

susnux avatar Aug 11 '24 14:08 susnux