Skip to content

Conversation

@cchaos
Copy link
Contributor

@cchaos cchaos commented Mar 2, 2022

EuiSelectable

I noticed that the changes to the inner content of EuiSelectableListItem made in #5581 really messed with some custom renders like in the sitewide search template:

Before
Screen Shot 2022-03-02 at 13 40 34 PM

Originally, the fix was to make it easier to override the truncate/flex nature of the inner list option elements but just removing the extra elements. This wasn't a good fix.

Instead, I've reverted back to the original contents and added an explicit textWrap = 'truncate' | 'wrap' option to EuiSelectableListItem and inherited this in EuiSelectableList and EuiSelectable.listProps. This immediately fixed the sitewide template:

After
Screen Shot 2022-03-02 at 13 39 35 PM

EuiSuggest

But it then broke the suggest list item (of course). So in EuiSuggest, I force EuiSuggestItem's own truncate property to be true when isVirtualize = true and set the listProps.textWrap: isVirtualized ? 'truncate' : 'wrap',.

This even fixes the display better for virtualized items by forcing the truncation instead of just cutting off the item:

Before
Screen Shot 2022-03-02 at 13 39 58 PM

After
Screen Shot 2022-03-02 at 13 24 17 PM

Checklist

  • Check against all themes for compatibility in both light and dark modes
  • Checked in mobile
  • Checked in Chrome, Safari, Edge, and Firefox
  • Props have proper autodocs and playground toggles
  • Added documentation
  • [ ] Checked Code Sandbox works for any docs examples
  • Added or updated jest and cypress tests
  • [ ] Checked for breaking changes and labeled appropriately
  • [ ] Checked for accessibility including keyboard-only and screenreader modes
  • A changelog entry exists and is marked appropriately

cchaos added 2 commits March 2, 2022 13:47
…ncate’`

And inherited this in [EuiSelectableList] and [EuiSelectable.listProps]
@cchaos cchaos added the bug label Mar 2, 2022
@cchaos cchaos requested a review from thompsongl March 2, 2022 19:00
cchaos added 2 commits March 2, 2022 14:06
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_5679/

Copy link
Contributor

@thompsongl thompsongl left a comment

Choose a reason for hiding this comment

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

All examples mentioned in the summary LGTM.
Code changes 👍

@cchaos cchaos enabled auto-merge (squash) March 2, 2022 20:41
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_5679/

@cchaos cchaos merged commit 288eb70 into elastic:main Mar 2, 2022
@cchaos cchaos deleted the fix/selectable_item_layout branch March 2, 2022 21:58
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.

3 participants