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 maxVisible option for select prompts #225

Merged
merged 3 commits into from
Nov 6, 2019

Conversation

elliot-nelson
Copy link
Contributor

@elliot-nelson elliot-nelson commented Nov 3, 2019

SUMMARY

Allow the "select" prompt to display a subset of the options at a time.

DETAILS

Changes to select

  • optionsPerPage option added, similar to multiselect
  • CHANGE - optionsPerPage now defaults to 10, which is a change in behavior if you had select lists with more than 10 elements. (I think this change is a net positive, but it probably requires at least a minor version bump.)

Changes to multiselect

  • UI: scrolling through options when there are more options than can be displayed now shows small arrows indicators next to the options list at the top/bottom of the list. The hint text below the list has been removed.

Test changes

  • Added a new tape file for utility unit tests, with a single entry (for entriesToDisplay).

PREVIEW

select-2

@elliot-nelson
Copy link
Contributor Author

Reviewer note: after making this change, I realized that the multiselect already has this feature, although with different UI and different option name. (But, basically the same behavior otherwise).

I think before merging this I'd like to:

  1. Change my implementation to match multiselect option name (optionsPerPage), for consistency.
  2. Change multiselect UI to match mine (drop the "Scroll up or down to see more options verbiage", and replace it with the arrow indicators, which I think are more interactive and intuitive).

@terkelg
Copy link
Owner

terkelg commented Nov 3, 2019

Looks really good @elliot-nelson! Could be nice to have this as a part of the next release. I agree we should try to have a consistent API 👍

@terkelg terkelg added this to the v2.3 milestone Nov 3, 2019
@elliot-nelson
Copy link
Contributor Author

Updated preview image to show changes to select and multiselect.

@bbernstein
Copy link
Contributor

bbernstein commented Nov 4, 2019

I was looking at this for autocomplete around the same time you submitted this. I was more focused on minimal code changes, but this is probably a cleaner solution and looks better. I can cancel my pull and feel free to add this to the autocomplete versions of this. The arrowIndicator is a nice touch.

Since it's not merged yet. I have a version that does the same for autocomplete using your helper-methods. One concern with mine is that it removes the pages in autocomplete. I don't know how much the pages are preferred, but I have the earlier PR for one that just puts everyhing in page 1 but adds another option smooth. Anyway, I'm happy to contribute one of these versions once this is merged.

autocomplete

@elliot-nelson
Copy link
Contributor Author

@bbernstein that looks great!

Personally, I think the pagination in the autocomplete should go away completely and just be scrolling, as then the experience for select, multi select, autocomplete, and autocompleMultiselect can all be the same.

(I like your "smooth" experience more than the pagination.)

@terkelg
Copy link
Owner

terkelg commented Nov 5, 2019

Thank you so much @elliot-nelson and @bbernstein. I agree, I think we should use this across all prompts instead of pagination. This provides a better user experience for sure. I appreciate the help. Can we choose/merge this and #227. I'm a bit busy this week, but I'll have some time to merge and release the next version over the weekend

@terkelg terkelg added the enhancement New feature or request label Nov 5, 2019
@bbernstein
Copy link
Contributor

I'll cancel what I had done earlier (at the same time as @elliot-nelson) and have made changes that will be based on this PR. Once this one is merged, I'll add my changes for a separate PR.

@terkelg terkelg merged commit d7d2c37 into terkelg:master Nov 6, 2019
@terkelg
Copy link
Owner

terkelg commented Nov 6, 2019

@bbernstein this is now merged into master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants