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

Sort order for FormTokenField #22048

Open
pwkip opened this issue May 2, 2020 · 7 comments
Open

Sort order for FormTokenField #22048

pwkip opened this issue May 2, 2020 · 7 comments
Labels
[Package] Components /packages/components [Type] Enhancement A suggestion for improvement.

Comments

@pwkip
Copy link
Contributor

pwkip commented May 2, 2020

The FormTokenField is a great component for adding relations between posts, taxonomies and any other resources. But it's pretty hard to change the order of the tokens.

The only work-around / alternative I have found so far is by first deleting the token and then re-inserting it.

I would like to suggest a drag and drop mechanism here, and maybe introduce some keyboard shortcuts for changing the order of the tokens.

I would also like to suggest an alternative layout option, that will force each token on a separate line. This, in combination with sort-order, would be pretty useful to create a list of custom related posts for example.

@paaljoachim
Copy link
Contributor

paaljoachim commented May 2, 2020

Hey Jules. That sounds great!
I made this multiselect issue a while ago:
#17009
(Contains links to additional issues.)

Here is also a Tags PR:
#21859

I mention the above issues as having a kind of multiselect drop down with a drag and drop element would be very helpful. As one could create a select list and drag the selections into a priority list.

@pwkip
Copy link
Contributor Author

pwkip commented May 2, 2020

Hi Paal, thanks the comments!

#17009 is very interesting. Good to know that it's possible to reuse components from WooCommerce as well.

#21859 doesn't seem so much related to this issue. I'm more interested in the extending the FormTokenField itself.

The tag-selection is performed on a higher level, by the FlatTermSelector component.
While it's true that the FlatTermSelector utilizes the FormTokenField, I would like to only focus on extending the FormTokenField here, by making the tokens sortable.

Would you say it's a good idea to make the tokens sortable? Obviously, for the tag-selection this is not important, but there are other use cases, where the sort-order might be relevant. This change-request is actually intended to help developers who want to create more powerful UIs with the default WP components.

@talldan
Copy link
Contributor

talldan commented May 4, 2020

#21589 seems pretty similar to me, it might be that addressing this issue also solves that issue, seeing as they're both related to the ordering used by the component.

@talldan talldan added [Package] Components /packages/components [Type] Enhancement A suggestion for improvement. labels May 4, 2020
@gsarig
Copy link

gsarig commented Oct 18, 2020

Drag and drop reorder would be great. Maybe for better accessibility, though, there should also be a complementary navigation using arrows. Here's a very rough sketch to get the idea of what I mean:

image

@grappler
Copy link
Member

This is something I am interested in looking into for defining the order of a list of posts.

@tcmulder
Copy link

This would be really useful. Deleting and re-adding items isn't a big deal with a few items (at first I was just using the FormTokenField to select taxonomy terms), but it gets much more cumbersome with a large number of items (now I'm using it to select individual posts, and there are a lot more items to dig through to reselect items). Even just to move the first item to the last slot means everything must be wiped out first and then be reselected from scratch.

@JiveDig
Copy link

JiveDig commented Aug 10, 2023

+1, I can definitely use this as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Components /packages/components [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

7 participants