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

Implement a TreeMultiSelectField in React #53

Closed
11 of 12 tasks
chillu opened this issue May 3, 2017 · 10 comments
Closed
11 of 12 tasks

Implement a TreeMultiSelectField in React #53

chillu opened this issue May 3, 2017 · 10 comments

Comments

@chillu
Copy link
Member

chillu commented May 3, 2017

Acceptance Criteria

  • I can choose multiple items from hierarchical data
  • I can search for items in the same way as with single select TreeDropdown (see TreeDropdownField - React Search Feature silverstripe-framework#6842)
  • I can remove single items for multi selects
  • Selected values show their labels even when the element is not available in the list yet (due to lazy loading)
  • The field complies with WCAG accessibility guidelines
  • The field can handle at least five selected items without breaking the layout
  • The field presents selection efficiently in readonly/disabled views

Tasks

  • Multiple values can be selected
  • Cater for "unchanged" empty value when no option is selected in TreeMultiselectField
  • Show selected values which are not found in the tree
  • Ensure single select still works
  • Ensure readonly/disabled view works with correct titles
  • unit tests

Nice to haves

  • simplify the logic around reducers and components
  • The field efficiently displays long tiles as selected items (and provides context on nested items)

Notes

  • This should be a specialisation of the existing <TreeDropdownField> component, ideally with minimal code duplication
  • The field UX isn't really designed for selecting lots of items (e.g. for "related documents", a relational GridField is the better choice).

Designs

Looking for feedback on these (WIP) https://projects.invisionapp.com/boards/D3X68PS46K28/

Related

Pull requests

@chillu
Copy link
Member Author

chillu commented May 3, 2017

Damian brought up a good point: We might not not this field at all.

  • MultiSelectField can already be used for "breadcrumb flattened" shallow trees like a groups hierarchy
  • Common uses like "related pages" typically rely on GridField with a single TreeDropdownField
  • We don't use TreeMultiSelectField in core

Given this, I'm removing the 4.0 milestone. Keeping the ticket around a bit until there's more clarity if we can remove this use case completely.

@chillu
Copy link
Member Author

chillu commented Jul 10, 2017

@clarkepaul Can you please give this some design love? Fairly high priority, since there's dependant cards.

@clarkepaul clarkepaul self-assigned this Jul 12, 2017
@chillu
Copy link
Member Author

chillu commented Jul 12, 2017

@clarkepaul Are you considering multi-select for large trees as well? This might need a multi-stage process, where you search, add one or more items from the results, then do another search and add more items.

@clarkepaul clarkepaul removed their assignment Jul 13, 2017
@clarkepaul
Copy link
Contributor

This needs a design review before dev starts ie there is no code to peer review.

@flamerohr
Copy link
Contributor

@clarkepaul The designs look good :) and inline with what react-select does so it shouldn't be too different aesthetic-wise
one question - should the border of the selected items be light grey instead? as it'll continue being light blue after users have tabbed to another field

@chillu
Copy link
Member Author

chillu commented Jul 14, 2017

@clarkepaul Designs look great! A few notes:

  • Should we include paths in the selected items? You could end up with two items having the same label and looking like duplicates, but in fact they're in different paths. We'll likely need ellipsis long titles as well. It does start to stretch this UI paradigm (as opposed to a more structured list-based selection)
  • How do we deal with long titles in selections?
  • It's a bit weird that the "parent" option is indented more than it's children ("Option 4" vs. "Option 4.1"), but I don't have a good solution for this either.
  • Does a click on a selected item in the list unselect the item, or close the panel?
  • I would expect that I can remove selected items by hitting backspace on my keyboard after focusing in the field. That's either built in to the JS lib already, or really hard to implement. Hopefully it's the former.
  • How do you visually communicate that you can still search by focusing on the main form element, even when existing selected items are in the field? We should make sure that this clickable space doesn't disappear depending on how much existing selection fills it.

image

@clarkepaul
Copy link
Contributor

clarkepaul commented Jul 17, 2017

Should we include paths in the selected items?

I think for now it's okay to not show the path for these, for the edge cases where there are items with the same name users will need to keep note of where they are at. If we add breadcrumbs the UI will bloat easily and become unusable to the majority of people using the tool. I also think we can leave names as full names and not truncate them (as per library we are using which works well enough)

How do we deal with long titles in selections?

They wrap onto the next line.

It's a bit weird that the "parent" option is indented more than its children

Agree it's weird but felt like it communicates the way back better as it's the opposite direction as the arrow going deeper. The alternative is to centre the parent "< Parent" in that area. Happy to hear thoughts as to which is preferred. Other option...
pasted_image_17_07_17__10_19_pm

Does a click on a selected item in the list unselect the item, or close the panel?

I don't think the click would do anything (ie. it is not selectable), nor would it close the panel.

Backspace on my keyboard after focusing in the field deletes item?

Yes that's built in

How do you visually communicate that you can still search by focusing on the main form element, even when existing selected items are in the field?

On focus, there is a flashing cursor line to indicate you can still type, this should be sufficient as space is at a premium.

@clarkepaul
Copy link
Contributor

@flamerohr do you mean the border for these selected items?
image
I was thinking to keep them with the selected blue border (similar to when you have files selected in the Files area) but will take your lead if that doesn't work in reality. Perhaps they are only blue when the field is focused or opened?

@flamerohr
Copy link
Contributor

Cheers, this answers all the questions, I think we could start implementing this after tasking it up :) moving it back to "Next"

@tractorcow
Copy link
Contributor

Reviewing now.

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

No branches or pull requests

4 participants