-
Notifications
You must be signed in to change notification settings - Fork 839
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
[EuiFilterSelectItem] Convert to Emotion + mark as deprecated #6982
[EuiFilterSelectItem] Convert to Emotion + mark as deprecated #6982
Conversation
focus.transparency
& focus.backgroundColor
theme tokens; Convert EuiFilterSelectItem
to Emotion; Deprecate EuiFilterSelectItem
EuiFilterSelectItem
+ set up required focus
theme tokens
3084e10
to
6020d02
Compare
- simplify border
+ remove `-isFocused` class - no usages in Kibana
- not sure if this is already in prod, squash if so
- in favor of text truncation CSS util
- prefer using an actual component / `EuiSelectableMessage` instead
- replace with `.eui-yScroll` and custom `maxHeight` Emotion CSS - there are no usages within EUI, but 15 usages within Kibana - we'll have to convert manually and ask consumers to
6020d02
to
781e57b
Compare
EuiFilterSelectItem
+ set up required focus
theme tokens
@breehall Sending this your way for review since you're on release/Kibana upgrade duty this week, and I'm wanting to get this conversion in before tomorrow's release (+ will be updating your Kibana upgrade PR). For the most part I'm hoping everything should be follow-able by commit, but please let me know if not or if anything is unclear! |
Preview documentation changes for this PR: https://eui.elastic.co/pr_6982/ |
781e57b
to
4bf91d4
Compare
- Fix mounted test affected by new class/emotion wrapper (convert to RTL) - update snapshots
4bf91d4
to
7f4a786
Compare
Preview documentation changes for this PR: https://eui.elastic.co/pr_6982/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey Cee, this looks good! Just two questions/considerations below for you. I checked this out in prod and everything looks good.
Since this component is slated to be deprecated in December of this year, do we have a timeframe for converting the guts of EuiComboBox
to EuiSelectable
? We may want to add this to our team roadmap for upcoming work.
isFocused: css` | ||
${focusStyles} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we removed the isFocus
class because it had no usages, do we need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, we still need this - the className wasn't being referenced directly in Kibana, but EUI still applies isFocused
styles manually. You can see this in EuiComboBox when using arrow keys to navigate through options - those aren't :focus
styles, they're isFocused
.
.euiFilterSelect__items { | ||
@include euiScrollBar; | ||
|
||
overflow-y: auto; | ||
max-height: $euiSize * 30; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since there are 15 usages in Kibana and this component has already been slated for deprecation, do you think there would be merit in adding these styles an exportable style from Emotion? My thinking is this could simplify the process of manually adding the class and the height. Adding it manually would be a very small change either way, but I'm curious on your thoughts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather leave cruft in Kibana than EUI I've already done the work locally in Kibana to convert all usages of this to className="eui-yScroll" css={{ maxHeight: euiTheme.base * 30 }}
, and also added a long comment also asking devs to switch to EuiSelectable which already has scrolling/max-height baked in OOTB.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Totally valid! Let's go with it!
fireEvent.focus(getByTestSubject('comboBoxSearchInput')); | ||
|
||
const dropdownOptions = baseElement.querySelectorAll('.euiFilterSelectItem'); | ||
expect( | ||
dropdownOptions[0]!.querySelector('[data-euiicon-type="check"]') | ||
).toBeFalsy(); | ||
expect( | ||
dropdownOptions[1]!.querySelector('[data-euiicon-type="check"]') | ||
).toBeTruthy(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for tackling my questions! This is good to go! 🚢
Haha whoops, I definitely yolo'd the deprecation date for December and forgot to mention it's a tentative month I chose semi-randomly. We're free to punt on that deprecation date if we don't convert by then, but I'm definitely hoping to get to it before then (+ honestly, it makes a lot of sense to do before EuiComboBox's Emotion conversion). |
I updated the deprecation meta issue to note that #2708 is required and the deprecation date can be moved if it's not yet complete. Thanks Bree! |
`85.0.0` ➡️ `85.1.0`⚠️ The biggest change in this PR by far is the **removal** of several `EuiFilterSelectItem` CSS classes and styles associated with those classes. EUI has previously exported component-specific CSS classes for usage such as `.euiFilterSelect__items`, `.euiFilterGroup__popoverPanel`, or `.euiAccordionForm`. ❌ **As of our move to CSS-in-JS, we are actively moving away from this architecture**. The goal is to either provide either a component or prop directly to you instead of a CSS class. As a reminder, our classNames are not guaranteed APIs and are subject to change without warning - should you need to tweak or customize EUI's styling, we strongly recommend passing in your own `className`. 💬 Moving forward, EUI will attempted to convert any usages of removed CSS classes and their direct usages in Kibana for you. In most cases, we'll hopefully be able to take the correct path of using a component or prop instead. In cases where we cannot or significant/complex changes are required, we may temporarily convert the CSS to a static CSS-in-JS usage instead and add a TODO asking the relevant team to address this in their own time (for example, the deprecation of `EuiFilterSelectItem` and its conversion to `EuiSelectable`). ## [`85.1.0`](https://github.com/elastic/eui/tree/v85.1.0) - Updated `EuiComboBox`'s `options` to accept `option.append` and `option.prepend` props ([#6953](elastic/eui#6953)) - Updated deprecated `.substr()` usages to `.substring()` ([#6954](elastic/eui#6954)) - Updated `EuiInlineEdit`'s read mode button to include a title tooltip, increasing readability of truncated text ([#6966](elastic/eui#6966)) **Bug fixes** - Fixed `EuiFilterGroup`'s responsive styles ([#6983](elastic/eui#6983)) **Deprecations** - Deprecated `EuiFilterSelectItem`; Use `EuiSelectable` instead ([#6982](elastic/eui#6982)) **CSS-in-JS conversions** - Converted `EuiFilterSelectItem` to Emotion ([#6982](elastic/eui#6982)) - Removed `.euiFilterSelect__items` CSS; Use `EuiSelectable` instead ([#6982](elastic/eui#6982)) - Removed `.euiFilterSelect__note` and `.euiFilterSelect__noteContent` CSS; Use `EuiSelectableMessage` instead ([#6982](elastic/eui#6982)) - Added `focus.transparency` and `focus.backgroundColor` theme tokens ([#6984](elastic/eui#6984)) --------- Co-authored-by: Cee Chen <constance.chen@elastic.co> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Summary
closes #6398
This PR:
Converts
EuiFilterSelectItem
to Emotion.euiFilterSelect__items
,.euiFilterSelect__note
, and.euiFilterSelect__noteContent
Improves the keyboard "focus" state of disabled items - now uses a clearly disabled background color instead of the previous primary background color
Marks
EuiFilterSelectItem
for deprecation - onceEuiComboBox
switches to dogfoodingEuiSelectable
, we should move away from it entirely and request that Kibana usages do so as wellQA
Note that I opted not to create stories for this component since we'll eventually be removing it. The easiest way to QA it is to view its usage in EuiComboBox, and ensure combo boxes look the same as production: https://eui.elastic.co/pr_6982/#/forms/combo-box
General checklist
- [ ] Checked in mobileAdded orupdated jestand cypress testsand screenreadermodes- [ ] Props have proper autodocs (using@default
if default values are missing) and playground toggles- [ ] Added documentation- [ ] Checked Code Sandbox works for any docs examples- [ ] Updated the Figma library counterpart- [ ] Checked for breaking changes and labeled appropriatelyEmotion checklist
Kibana usage
- [ ] Search Kibana's codebase for{euiComponent}-
(case sensitive) to check for usage of modifier classes- [ ] If usage exists, consider converting to adata
attribute so that consumers still have something to hook into**/target, **/*.snap, **/*.storyshot
for less noise) foreui{Component}
(case sensitive) to find:[ ] Any test/query selectors that will need to be updated- None[ ] Any Sass or CSS that will need to be updated, particularly if a component Sass var was deletedeuiBadge
class on a div instead of simply using theEuiBadge
component)General
className(s)
read as expected in snapshots and browsers- [ ] Checked component playgroundNo playground/docs for this componentUnit tests
shouldRenderCustomStyles()
test was added and passes with parent component and any nestedchildProps
(e.g.tooltipProps
)Sass/Emotion conversion process
src/components/index.scss
- [ ] Deleted anysrc/amsterdam/overrides/{component}.scss
files (styles within should have been converted to the baseline Emotion styles)- [ ] Converted all global Sass vars/mixins to JS (e.g.$euiSize
toeuiTheme.size.base
)- [ ] Removed or converted component-specific Sass vars/mixins to exported JS versions- [ ] Listed var/mixin removals in changelog- [ ] Ranyarn compile-scss
to update var/mixin JSON files- [ ] Simplifiedcalc()
tomathWithUnits
if possible (if mixing different unit types, this may not be possible)- [ ] Added an@warn
deprecation message within theglobal_styling/mixins/{component}.scss
fileCSS tech debt
-inline
and-block
logical properties (check inline styles as well as CSS)- [ ] Wrapped all animations or transitions ineuiCanAnimate
- [ ] Usedgap
property to add margin between items if using flexDOM Cleanup
euiComponent
,euiComponent__child
)- [ ] SEARCH KIBANA FIRST: Deleted any modifier classNames or maps if not being used in Kibana.Extras/nice-to-have
- [ ] Documentation pass:- [ ] Check for issues in the backlog that could be a quick fix for that component- [ ] Optional component/code cleanup: consider splitting up the component into multiple children if it's overly verbose or difficult to reason about