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

[EuiComboBox] Update to dogfood EuiInputPopover #7246

Merged
merged 12 commits into from
Oct 5, 2023

Conversation

cee-chen
Copy link
Member

@cee-chen cee-chen commented Oct 2, 2023

Summary

closes #7192

🙈 I know this PR is huge, I'm sorry. I think most of it is just tests and snapshots. I tried to break commits up as atomically as I could, but unfortunately I couldn't see a clean place to split up the PR into smaller PRs without breaking functionality or making 1:1 conversions harder to follow.

The first and last commits are actually the only ones needed functionally (dogfooding EuiInputPopover and adding inputPopoverProps).

However, it turns out there was a shit-ton of custom/duplicate logic in EuiComboBox's custom portalled dropdown menu (implemented before EuiInputPopover was created) that became functionally useless once we switched over. So a good 60%+ of this PR is me arduously going method by method through the component and its subcomponents and figuring out what could be safely yeeted and what couldn't. Turns out there's a lot of legacy code in EuiComboBox 💀

There was one EuiComboBox functionality (auto-closing the popover on scroll, added in #2106 / #2099) that I ported over to EuiInputPopover in 7e0cdc2 as an optional prop.

REVIEWER NOTE: The 2nd-to-last TESTS commit is kind of a dumpster fire and I would recommend skimming it and not thoroughly reviewing. EuiComboBox tests are incredibly lacking and will almost certainly need to be at least partially rewritten in any case once we convert EuiComboBox to dogfood EuiSelectable, so the entire commit is basically a nice to have at best 🥲

Screencaps

This entire massive refactor is really just for the last commit, so Kibana can do this:

<EuiComboBox inputPopoverProps={{ minPanelWidth: 300 }} />

QA

General checklist

  • Browser QA
    • Checked in both light and dark modes
    • Checked in mobile
    • Checked in Chrome, Safari, Edge, and Firefox
    • Checked for accessibility including keyboard-only and screenreader modes (Quick note on this: EuiComboBox screen reader experience isn't as optimal as EuiSelectable, this is already in the case in production)
  • Docs site QA
    • Props have proper autodocs (using @default if default values are missing) and playground toggles
      - [ ] Added documentation - Skipped as there isn't a lot of consumer-facing info to know
      - [ ] 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) ❓ I'm 98% sure there should not be any end-user-facing changes, and there also shouldn't be any consumer usage/prop changes. Please shout if you see otherwise
  • Designer checklist - N/A

+ rip out custom EuiPortal and EuiPopoverPanel usage

- there's still a lot more logic to rip out which EuiInputPopover already handles, this is just the minimum needed to maintain working behavior
- underlying popover component takes care of that

+ remove `euiBody-hasPortalContent` logic (if underlying EuiPopover/EuiPortal components don't need it, combobox shouldn't either)

- note: type exported from index was not being used by any consumer-facing component, so I don't think it's a breaking change to remove it

- TODO: pass resize-observer `width` from EuiInputPopover to combobox options component
- EuiPopover already handles this automatically under the hood

+ add regression test for this, since this had a issue filed in Kibana at some point (3551)
- TODO: should `EuiSuperSelect` use this new prop as well?
- EuiInputPopover is already managing this via resize observer
- by passing more elegant props to virtualized `FixedSizeList` component
- no idea if this breaks production because there are apparently no tests for this, but it looks unnecessary

- we should be ready to roll this individual commit back if necessary / if Kibana breaks
- friendship with enzyme is over, RTL is my new best friend

- remove snapshots that weren't asserting anything meaningful

- turn off whitespace changes, etc etc

- I probably should have broken this up a bit more into separate PRs but tbh these tests aren't great and will almost certainly need to be rewritten from scratch once we convert EuiComboBox to EuiSelectable in any case, so f it
@elasticmachine

This comment was marked as outdated.

@cee-chen
Copy link
Member Author

cee-chen commented Oct 2, 2023

Despite this not being a "breaking" change, this may be worth doing a pre-release for and testing against Kibana CI (particularly FTR and Cypress). Unfortunately, Kibana uses a lot of comboboxes in many places and combobox E2E are somewhat... fragile. Better to catch stuff now than have to do a bunch of patches later.

@kibanamachine
Copy link

Preview staging links for this PR:

@cee-chen cee-chen marked this pull request as ready for review October 3, 2023 07:22
@cee-chen cee-chen requested a review from a team as a code owner October 3, 2023 07:22
@cee-chen cee-chen requested a review from 1Copenut October 3, 2023 07:22
Copy link
Contributor

@1Copenut 1Copenut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 LGTM. I took a look at individual commits, the entire code change, preview site, and ran through it with NVDA for a quick regression test. The new code is easier to follow and removing the EuiPortal was a nice refactor.

@cee-chen
Copy link
Member Author

cee-chen commented Oct 5, 2023

Prerelease CI test: elastic/kibana#168053

No FTR failures (🤯 🎉) and Jest tests are snapshots/fairly quick fixes. Hooray! Going ahead and merging this for next week's release.

@cee-chen cee-chen merged commit e09776c into elastic:main Oct 5, 2023
2 checks passed
@cee-chen cee-chen deleted the combobox-input-popover branch October 5, 2023 02:36
1Copenut pushed a commit to elastic/kibana that referenced this pull request Oct 11, 2023
`v88.5.4`⏩`v89.0.0`

---

## [`89.0.0`](https://github.com/elastic/eui/tree/v89.0.0)

- Added new `pushAnimation` prop to push `EuiFlyout`s, which enables a
slide in animation ([#7239](elastic/eui#7239))
- Updated `EuiComboBox` to use `EuiInputPopover` under the hood
([#7246](elastic/eui#7246))
- Added `inputPopoverProps` to `EuiComboBox`, which allows customizing
the underlying popover
([#7246](elastic/eui#7246))
- Added a new beta `EuiTextBlockTruncate` component for multi-line
truncation ([#7250](elastic/eui#7250))
- Updated `EuiBasicTable` and `EuiInMemoryTable` to support multi-line
truncation. This can be set via `truncateText.lines` in the `columns`
prop. ([#7254](elastic/eui#7254))

**Bug fixes**

- Fixed `EuiFlexGroup` and `EuiFlexGrid`'s `m` gutter size
([#7251](elastic/eui#7251))
- Fixed focus trap rerender issues in `EuiFlyout` with memoization
([#7259](elastic/eui#7259))
- Fixed a visual bug with `EuiContextMenu`'s animation between panels
([#7268](elastic/eui#7268))

**Breaking changes**

- EUI's global body font-size now respects the `font.defaultUnits`
token. This means that the global font size will use the `rem` unit by
default, instead of `px`.
([#7182](elastic/eui#7182))
- Removed exported `accessibleClickKeys`, `comboBoxKeys`, and
`cascadingMenuKeys` services. Use the generic `keys` service instead
([#7256](elastic/eui#7256))
- Removed `EuiColorStops` due to low usage
([#7262](elastic/eui#7262))
- Removed `EuiSuggest`. We recommend using `EuiSelectable` or
`EuiComboBox` instead
([#7263](elastic/eui#7263))
- Removed `euiHeaderAffordForFixed` Sass mixin, and `$euiHeaderHeight`
and `$euiHeaderHeightCompensation` Sass variables. Use the CSS variable
`--var(euiFixedHeadersOffset, 0)` instead.
([#7264](elastic/eui#7264))

**Accessibility**

- When using `rem` or `em` font units, EUI now respects, instead of
ignoring, browser default font sizes set by end users.
([#7182](elastic/eui#7182))
dej611 pushed a commit to dej611/kibana that referenced this pull request Oct 17, 2023
`v88.5.4`⏩`v89.0.0`

---

## [`89.0.0`](https://github.com/elastic/eui/tree/v89.0.0)

- Added new `pushAnimation` prop to push `EuiFlyout`s, which enables a
slide in animation ([elastic#7239](elastic/eui#7239))
- Updated `EuiComboBox` to use `EuiInputPopover` under the hood
([elastic#7246](elastic/eui#7246))
- Added `inputPopoverProps` to `EuiComboBox`, which allows customizing
the underlying popover
([elastic#7246](elastic/eui#7246))
- Added a new beta `EuiTextBlockTruncate` component for multi-line
truncation ([elastic#7250](elastic/eui#7250))
- Updated `EuiBasicTable` and `EuiInMemoryTable` to support multi-line
truncation. This can be set via `truncateText.lines` in the `columns`
prop. ([elastic#7254](elastic/eui#7254))

**Bug fixes**

- Fixed `EuiFlexGroup` and `EuiFlexGrid`'s `m` gutter size
([elastic#7251](elastic/eui#7251))
- Fixed focus trap rerender issues in `EuiFlyout` with memoization
([elastic#7259](elastic/eui#7259))
- Fixed a visual bug with `EuiContextMenu`'s animation between panels
([elastic#7268](elastic/eui#7268))

**Breaking changes**

- EUI's global body font-size now respects the `font.defaultUnits`
token. This means that the global font size will use the `rem` unit by
default, instead of `px`.
([elastic#7182](elastic/eui#7182))
- Removed exported `accessibleClickKeys`, `comboBoxKeys`, and
`cascadingMenuKeys` services. Use the generic `keys` service instead
([elastic#7256](elastic/eui#7256))
- Removed `EuiColorStops` due to low usage
([elastic#7262](elastic/eui#7262))
- Removed `EuiSuggest`. We recommend using `EuiSelectable` or
`EuiComboBox` instead
([elastic#7263](elastic/eui#7263))
- Removed `euiHeaderAffordForFixed` Sass mixin, and `$euiHeaderHeight`
and `$euiHeaderHeightCompensation` Sass variables. Use the CSS variable
`--var(euiFixedHeadersOffset, 0)` instead.
([elastic#7264](elastic/eui#7264))

**Accessibility**

- When using `rem` or `em` font units, EUI now respects, instead of
ignoring, browser default font sizes set by end users.
([elastic#7182](elastic/eui#7182))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[EuiComboBox] Update with panelMinWidth behavior
4 participants