eui icon indicating copy to clipboard operation
eui copied to clipboard

feat: add option to disable field value selection auto sort (issue #7955)

Open tgalfin opened this issue 1 year ago • 2 comments

Summary

This PR adds a config option to disable auto sort behavior for field value selection filters (addresses https://github.com/elastic/eui/issues/7955) on eui search. In small lists it can be quite annoying to have options jumping around, so it's useful to have a way to disable this. The default behavior is unchanged (selected items will sort to the top of the list). If the optional prop is set to false, items will remain in their original order when selected. I modified the cypress test to include a test case for this. This can also be manually tested from the docs site by adding autoSortOptions: false to one of the field value toggles.

No options selected image

Default behavior image

Behavior when autoSortOptions is set to false image

I tried to fill out the checklist, but there were a few items I wasn't sure about so I left them blank.

QA

Remove or strikethrough items that do not apply to your PR.

General checklist

  • Browser QA
    • [X] Checked in both light and dark modes
    • [ ] Checked in mobile
    • [X] Checked in Chrome, Safari, Edge, and Firefox
    • [ ] ~~Checked for accessibility including keyboard-only and screenreader modes~~
  • Docs site QA
  • Code quality checklist
  • Release checklist
    • [x] A changelog entry exists and is marked appropriately.
    • [ ] ~~If applicable, added the breaking change issue label (and filled out the breaking change checklist)~~
  • Designer checklist
    • [ ] If applicable, file an issue to update EUI's Figma library with any corresponding UI changes. (This is an internal repo, if you are external to Elastic, ask a maintainer to submit this request)

tgalfin avatar Aug 13 '24 02:08 tgalfin

👋 Since this is a community submitted pull request, a Buildkite build has not been started automatically. Would an Elastic organization member please verify the contents of this pull request and kick off a build manually?

github-actions[bot] avatar Aug 13 '24 02:08 github-actions[bot]

Hey @tgalfin, thanks so much for the PR! Just wanted to give you a heads up that our team is currently wrapping up several large projects this week, but I'm planning on taking a look at this PR and getting it shipped after that. Thanks for your patience!

cee-chen avatar Aug 17 '24 06:08 cee-chen

@tgalfin Amazing job on this, your changes are delightfully elegant! I've made some nitty copy/test tweaks and will go ahead and merge this once CI is done running and I've done a final QA pass on the built docs/storybook.

cee-chen avatar Aug 29 '24 03:08 cee-chen

I ended up going down a bit of a rabbit hole with this file - there was a ton of 5-7 year old code in it that needed updating and cleaning up (not to mention tests 🫠). Let me know if you have any questions that aren't covered by the individual git commit messages.

One fun perf bonus that I was chasing because the scrolling UX was bugging me a bit - EuiSelectable's list of options/filters no longer flashes due to fully unmounting + remounting 🎉

cee-chen avatar Aug 30 '24 01:08 cee-chen

buildkite test this

cee-chen avatar Aug 30 '24 02:08 cee-chen

:green_heart: Build Succeeded

History

  • :green_heart: Build #2660 succeeded 11e4b0e142e3e13a125ce029bddbf5c31c4e416e

elasticmachine avatar Aug 30 '24 02:08 elasticmachine