eui
eui copied to clipboard
feat: add option to disable field value selection auto sort (issue #7955)
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
Default behavior
Behavior when autoSortOptions is set to false
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
- [X] Added documentation
- [ ] Props have proper autodocs (using
@defaultif default values are missing) and playground toggles - ~~[ ] Checked Code Sandbox works for any docs examples~~
- Code quality checklist
- [X] Added or updated jest and cypress tests
- [ ] Updated visual regression tests
- 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)
👋 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?
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!
@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.
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 🎉
buildkite test this
:green_heart: Build Succeeded
- Buildkite Build
- Commit: c4972d264cee70d5f23736fdb6ec0bf8aaae960e
History
- :green_heart: Build #2660 succeeded 11e4b0e142e3e13a125ce029bddbf5c31c4e416e