Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the rank question type #243

Open
1 of 3 tasks
lognaturel opened this issue Oct 18, 2024 · 2 comments · May be fixed by #274
Open
1 of 3 tasks

Add the rank question type #243

lognaturel opened this issue Oct 18, 2024 · 2 comments · May be fixed by #274
Assignees

Comments

@lognaturel
Copy link
Member

lognaturel commented Oct 18, 2024

User stories

  • As a form user, I want to change the relative position of items to express their ordering.
  • As a form user, I don't want any risk of accidentally changing the relative position of items as I'm navigating through my form

User interested in using it: https://forum.getodk.org/t/select-multiple-choices-then-rank-the-selected-choices/16444/15?u=ln

Design

Use a drag and drop interface as in Collect and Enketo: https://docs.getodk.org/form-question-types/#rank-widget. The goal here is to leverage the same design pattern with both Web Forms and Collect to create consistency in the user experience.

We believe users won't accidentally move the items if we use the "hold and drag" interaction and exploring the arrows for keyboard users. In Collect, we display the rank options in a modal, but that involves more steps for the user, so we want to change it to be inline.

The closest component in the design system is the reorder function. If possible, we want to remove the header, add the drag icon to the row, and add a highlighted state when the user is moving the item. Something to play around with once we have a working prototype, is making the entire row moveable vs moving from the drag icon specifically. From the drag icon might be tricky for people to use with different access needs or large fingers. Ideally the "hold and drag" can happen anywhere on the option and that's is enough friction to prevent any mistakes.

Figma designs - work in progress 🚧

Out of scope

  • clear state (we will work on this later)

Notes

Component options:

Todo

  • @lognaturel: refresh memory on why we introduced odk:rank as a type instead of using string. Maybe because any consumer needs to know that the string has semantics beyond a regular string? But the same could be said for select one|multiple. Make sure it's documented at https://getodk.github.io/xforms-spec/#data-types
  • @alyblenkin: attach mockup specific to Web Forms
    • How do we want to reduce the chance of accidental reordering when on a touch device? Enketo has an attempt with a "Click to start" but it doesn't address what happens after first data entry has been made and the user is still navigating the form. Mantine has a version where the handle must be used.
@latin-panda
Copy link
Collaborator

The assignee and status fields are currently disabled for me, but I wanted to let you know that I'm working on this ticket, and the status is now 'In Progress.' I'll be opening a draft PR shortly to provide visibility into the incremental progress and to gather early feedback.

@lognaturel lognaturel moved this from Todo to In Progress in Web Forms Jan 13, 2025
@latin-panda latin-panda linked a pull request Jan 14, 2025 that will close this issue
5 tasks
@latin-panda
Copy link
Collaborator

latin-panda commented Jan 16, 2025

Update:

  • This component will keep the odk:rank bind type, which is ultimately a string. No more types are introduced by now.
  • The namespaced control/body element name (<odk:rank>) is correct, as ODK invented the rank, not from W3C XForms.
  • This component implementation is similar to multi-select, with the difference that the value keeps all the options, and the order is important.
  • Clear state (trash can icon) and Click to start aren't part of this iteration.
  • Each option has a drag indicator (icon) and arrow buttons. The option's width is fully extended to the screen size.
  • The arrow buttons are hidden on mobile devices, making them easier to use on smaller screens and allowing text to wrap less, contributing to better readability.
  • Hold and drag are anywhere in the option (not just the icon), making them easier to use.
  • The hold should last a few milliseconds to activate the drag and prevent accidental reordering.
Small screen Rank component Small screen Rank component

Component implementation options:

  • PrimeVue OrderList - Discarded, not the desired experience
  • PrimeVue Reorderable table - Discarded, it doesn't work in Android browsers (known bug reported)
  • vue-draggable-next - Discarded, based on Sortable.js as vue-draggable-plus does, but it has fewer configurations and not so actively maintained by the community.
  • ⭐️ vue-draggable-plus - Promising, it works in Android browsers and has the configuration we need to achieve the desired UX. It has an active community, and a Vue team member made it. Now, I'm testing it in more depth by implementing basic UX we need.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

2 participants