nextstrain / nextclade

Viral genome alignment, mutation calling, clade assignment, quality checks and phylogenetic placement
https://clades.nextstrain.org
MIT License
219 stars 58 forks source link

Allow toggling of sort state by clicking on column name/text itself #1537

Open corneliusroemer opened 4 days ago

corneliusroemer commented 4 days ago

Good feature suggestion by @tsibley in a PR comment:

I can't seem to sort by emerging subclade, why is that @ivan-aksamentov?

It's literally because the text doesn't wrap, which forces the sort asc/desc icons out of view. If I make the text wrap, you can see/use them.

image

It's conventional to allow clicking the column name/text itself to toggle thru sort state (asc, desc, none), which would at least restore functionality if not the indicators.

_Originally posted by @tsibley in https://github.com/nextstrain/nextclade_data/issues/228#issuecomment-2417446906_

tsibley commented 4 days ago

Could also adjust layout of those column headings to ensure the indicators are always visible (i.e. force tighter wrapping).

ivan-aksamentov commented 4 days ago

I think this can be added fairly easily, just never got time to open the editor at this file specifically :)

One reason why hasn't been implemented immediately is because I tried to preserve stable property of sorting - you can sort by one criterion and then by another one and the equivalent elements will stay in place. This allows for more informative viz in my opinion, and a good UX practice for sortable tables. I mostly take inspiration from popular spreadsheet software, e.g. Excel. When you click on label you cannot pick direction right away - I wasn't sure if it affects the idea or not. But even if it breaks my UX idea, if Cornelius did not need stable sort, then I think it's fair to say that most users also would not miss it.

Another thing is that I'd like to replace this table with a more general alignment viewer widget sometimes (it would combine arbitrary columns with a more performant and featureful sequence view). That's on my mid term TODO list. The old code is a bit dated and messy.

ivan-aksamentov commented 4 days ago

Could also adjust layout of those column headings to ensure the indicators are always visible (i.e. force tighter wrapping).

Another option is to put arrows above and below the label, rather than on the right side. Some tables also have the arrows which only appear on hover, as an overlay - this way we would not need to reserve extra space for them. (looking at the text you can see that the space is a bit of a struggle)