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

DynamicTags reordering with drag'n drop #5643

Open
3 tasks done
Tracked by #6736 ...
simplg opened this issue Jan 29, 2024 · 0 comments · May be fixed by #6829
Open
3 tasks done
Tracked by #6736 ...

DynamicTags reordering with drag'n drop #5643

simplg opened this issue Jan 29, 2024 · 0 comments · May be fixed by #6829
Labels
feature request New feature or request pr welcome

Comments

@simplg
Copy link

simplg commented Jan 29, 2024

Clear and concise description of the problem

When using dynamictags, each time you add an element, it is always inserted at the end. You could programmatically change the order (for example, alphabetical) with listeners to on-update but this would limit the reordering to only a set of rules that the developer implemented.

What I propose is a property on DynamicTags draggable which would enable the user to move around tags as they want them to be ordered. For example, in a paper, the authors are usually ordered by order of contribution so you can't programmatically apply a rule for ordering them, only the user can order correctly the authors.
Today, if you wrote the wrong tag or ordered it incorrectly, as a user you need to remove every tag after it and insert them back correctly. It's a tedious task.

This is not entirely related to #501 since DynamicTags doesn't possess a filterOption as Select has.

Suggested solution

As suggested above, we could add a property draggable in order to make tags possible to move around. Tags should only be able to move in their own component (moving tags across dynamictags component would be out of scope of this issue).

When dragging a tag, a visual cue that you are moving it should be displayed. For example, it could be a grayed/transparent tag moving in the list of tags.

In order to know where a tag should be moved when dropped, it might be necessary to register all x,y positions of each tag at the start of the drag. Then, when dragging, check the position of the mouse in order to know where to move the visual cue between the tags.

Alternative

IntersectionObserver could also be used instead of x,y positions.

Additional context

No response

Validations

  • Read the Contributing Guidelines.
  • Read the docs.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request pr welcome
Projects
None yet
2 participants