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

[EuiSearchBar] Allow disabling selection auto sort in field_value_selection filters #7958

Merged
merged 11 commits into from
Aug 30, 2024

Conversation

tgalfin
Copy link
Contributor

@tgalfin tgalfin commented Aug 13, 2024

Summary

closes #7955

This PR adds a config option to disable auto sort behavior for field value selection filters for EuiSearchBar. 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

General checklist

  • Browser QA
    • Checked in Chrome, Safari, Edge, and Firefox
      - [ ] Checked in both light and dark modes
      - [ ] Checked in mobile
      - [ ] Checked for accessibility including keyboard-only and screenreader modes
  • Docs site QA
    • Updated docs/storybook with example of new prop
    • Props have proper autodocs (using @default if default values are missing) and playground toggles
      - [ ] Checked Code Sandbox works for any docs examples
  • Code quality checklist
  • Release checklist
    • 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 - N/A

@tgalfin tgalfin requested a review from a team as a code owner August 13, 2024 02:34
Copy link

👋 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?

@cee-chen
Copy link
Member

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!

- move to a `describe` block with config key + move closer to `autoClose`
- remove unnecessary `...requiredProps`, reuse `staticOptions` const
- clean up assertions slightly
- Tweak props table order
- Minor wordsmithing
+ fix filters stories file name
@cee-chen
Copy link
Member

@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.

- instead of `all/shown`, use `unsorted` and `sorted` to reflect new prop usage
- appears to have been used before EuiSearchBar dogfooded EuiSelectable
- store the count of activeItems instead of a full array, since we only care about the length

- use getters and modern nullish syntax for configs with defaults
@cee-chen cee-chen changed the title feat: add option to disable field value selection auto sort (issue #7955) [EuiSearchBar] Allow disabling selection auto sort to field_value_selection filters Aug 29, 2024
- remove separate async `resolveOptionsLoader` fn - for some reason this separate method causes the EuiSelectableList to remount completely, no idea why :T

+ add missing clearTimeout for scheduled cache wipe, which could potentially cause stale errors after unmount
+ add missing test case for `cache` config
@cee-chen cee-chen changed the title [EuiSearchBar] Allow disabling selection auto sort to field_value_selection filters [EuiSearchBar] Allow disabling selection auto sort in field_value_selection filters Aug 30, 2024
…checked

+ retain selected/active index highlight (better UX than before, where focus/active index was lost)

+ simplify stateful test components and update autosort tests to be simpler and check for active attributes
@cee-chen
Copy link
Member

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
Copy link
Member

buildkite test this

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

@cee-chen cee-chen merged commit 383df3d into elastic:main Aug 30, 2024
5 checks passed
jbudz pushed a commit to elastic/kibana that referenced this pull request Sep 10, 2024
`v95.9.0`⏩`v95.10.1`

> [!note]
> **EuiDataGrid**'s header cells have received a major UX change in
order to support interactive children within header content. Column
header actions now must be hovered and then clicked directly, or opened
with the Enter key, as opposed to being able to click the entire header
cell to see the actions popover.

_[Questions? Please see our Kibana upgrade
FAQ.](https://github.com/elastic/eui/blob/main/wiki/eui-team-processes/upgrading-kibana.md#faq-for-kibana-teams)_

---

## [`v95.10.0`](https://github.com/elastic/eui/releases/v95.10.0)

- Updated `EuiDataGrid` to support interactive header cell content
([#7898](elastic/eui#7898))
- Updated `EuiSearchBar`'s `field_value_selection` filter type with a
new `autoSortOptions` config, allowing consumers to configure whether or
not selected options are automatically sorted to the top of the filter
list ([#7958](elastic/eui#7958))
- Updated `getDefaultEuiMarkdownPlugins` to support the following new
default plugin configurations:
([#7985](elastic/eui#7985))
- `parsingConfig.linkValidator`, which allows configuring
`allowRelative` and `allowProtocols`
  - `parsingConfig.emoji`, which allows configuring emoticon parsing
- `processingConfig.linkProps`, which allows configuring rendered links
with any props that `EuiLink` accepts
- See our **Markdown plugins** documentation for example
`EuiMarkdownFormat` and `EuiMarkdownEditor` usage
- Updated `EuiDatePicker` to support `append` and `prepend` nodes in its
form control layout ([#7987](elastic/eui#7987))

**Bug fixes**

- Fixed border rendering bug with inline `EuiDatePicker`s with
`shadow={false}` ([#7987](elastic/eui#7987))
- Fixed `EuiSuperSelect`'s placeholder text color to match other form
controls ([#7995](elastic/eui#7995))

**Accessibility**

- Improved the keyboard navigation and screen reader output for
`EuiDataGrid` header cells
([#7898](elastic/eui#7898))

## [`v95.10.1`](https://github.com/elastic/eui/releases/v95.10.1)

**Bug fixes**

- Fixed a visual bug in compact density `EuiDataGrid`s, where the header
cell height would increase when the actions button became visible
([#7999](elastic/eui#7999))

---------

Co-authored-by: Lene Gadewoll <lene.gadewoll@elastic.co>
gergoabraham pushed a commit to gergoabraham/kibana that referenced this pull request Sep 13, 2024
`v95.9.0`⏩`v95.10.1`

> [!note]
> **EuiDataGrid**'s header cells have received a major UX change in
order to support interactive children within header content. Column
header actions now must be hovered and then clicked directly, or opened
with the Enter key, as opposed to being able to click the entire header
cell to see the actions popover.

_[Questions? Please see our Kibana upgrade
FAQ.](https://github.com/elastic/eui/blob/main/wiki/eui-team-processes/upgrading-kibana.md#faq-for-kibana-teams)_

---

## [`v95.10.0`](https://github.com/elastic/eui/releases/v95.10.0)

- Updated `EuiDataGrid` to support interactive header cell content
([elastic#7898](elastic/eui#7898))
- Updated `EuiSearchBar`'s `field_value_selection` filter type with a
new `autoSortOptions` config, allowing consumers to configure whether or
not selected options are automatically sorted to the top of the filter
list ([elastic#7958](elastic/eui#7958))
- Updated `getDefaultEuiMarkdownPlugins` to support the following new
default plugin configurations:
([elastic#7985](elastic/eui#7985))
- `parsingConfig.linkValidator`, which allows configuring
`allowRelative` and `allowProtocols`
  - `parsingConfig.emoji`, which allows configuring emoticon parsing
- `processingConfig.linkProps`, which allows configuring rendered links
with any props that `EuiLink` accepts
- See our **Markdown plugins** documentation for example
`EuiMarkdownFormat` and `EuiMarkdownEditor` usage
- Updated `EuiDatePicker` to support `append` and `prepend` nodes in its
form control layout ([elastic#7987](elastic/eui#7987))

**Bug fixes**

- Fixed border rendering bug with inline `EuiDatePicker`s with
`shadow={false}` ([elastic#7987](elastic/eui#7987))
- Fixed `EuiSuperSelect`'s placeholder text color to match other form
controls ([elastic#7995](elastic/eui#7995))

**Accessibility**

- Improved the keyboard navigation and screen reader output for
`EuiDataGrid` header cells
([elastic#7898](elastic/eui#7898))

## [`v95.10.1`](https://github.com/elastic/eui/releases/v95.10.1)

**Bug fixes**

- Fixed a visual bug in compact density `EuiDataGrid`s, where the header
cell height would increase when the actions button became visible
([elastic#7999](elastic/eui#7999))

---------

Co-authored-by: Lene Gadewoll <lene.gadewoll@elastic.co>
markov00 pushed a commit to markov00/kibana that referenced this pull request Sep 18, 2024
`v95.9.0`⏩`v95.10.1`

> [!note]
> **EuiDataGrid**'s header cells have received a major UX change in
order to support interactive children within header content. Column
header actions now must be hovered and then clicked directly, or opened
with the Enter key, as opposed to being able to click the entire header
cell to see the actions popover.

_[Questions? Please see our Kibana upgrade
FAQ.](https://github.com/elastic/eui/blob/main/wiki/eui-team-processes/upgrading-kibana.md#faq-for-kibana-teams)_

---

## [`v95.10.0`](https://github.com/elastic/eui/releases/v95.10.0)

- Updated `EuiDataGrid` to support interactive header cell content
([elastic#7898](elastic/eui#7898))
- Updated `EuiSearchBar`'s `field_value_selection` filter type with a
new `autoSortOptions` config, allowing consumers to configure whether or
not selected options are automatically sorted to the top of the filter
list ([elastic#7958](elastic/eui#7958))
- Updated `getDefaultEuiMarkdownPlugins` to support the following new
default plugin configurations:
([elastic#7985](elastic/eui#7985))
- `parsingConfig.linkValidator`, which allows configuring
`allowRelative` and `allowProtocols`
  - `parsingConfig.emoji`, which allows configuring emoticon parsing
- `processingConfig.linkProps`, which allows configuring rendered links
with any props that `EuiLink` accepts
- See our **Markdown plugins** documentation for example
`EuiMarkdownFormat` and `EuiMarkdownEditor` usage
- Updated `EuiDatePicker` to support `append` and `prepend` nodes in its
form control layout ([elastic#7987](elastic/eui#7987))

**Bug fixes**

- Fixed border rendering bug with inline `EuiDatePicker`s with
`shadow={false}` ([elastic#7987](elastic/eui#7987))
- Fixed `EuiSuperSelect`'s placeholder text color to match other form
controls ([elastic#7995](elastic/eui#7995))

**Accessibility**

- Improved the keyboard navigation and screen reader output for
`EuiDataGrid` header cells
([elastic#7898](elastic/eui#7898))

## [`v95.10.1`](https://github.com/elastic/eui/releases/v95.10.1)

**Bug fixes**

- Fixed a visual bug in compact density `EuiDataGrid`s, where the header
cell height would increase when the actions button became visible
([elastic#7999](elastic/eui#7999))

---------

Co-authored-by: Lene Gadewoll <lene.gadewoll@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[EuiSearchBar] Field value selection filter option to disable auto sort
3 participants