Repository navigation
Conversation
|
ℹ️ Because this component is meant to be an internal only component, we're not adding a changelog for it specifically. |
f4ab7f3 to
789a53a
Compare
789a53a to
0efff42
Compare
ek-so
left a comment
There was a problem hiding this comment.
Thank you! Looking good, as discussed — left and right paddings from the text to be removed.
- based on review feedback design adjustment
- due to removed text padding
- this was originally part of EuiSelectableList already
- with this we can prevent showcasing unwanted prop combinations
weronikaolejniczak
left a comment
There was a problem hiding this comment.
Fantastic work, Lene! 🙌🏻 Really happy that we could create such an internal component after all, it should drive the consistency between so many list components we have. Thanks for the detailed description and QA checklist!
I have a couple of nits, one comment regarding interface and several doubts regarding behavior when going through the checklist (see below). But nothing huge... 🤞🏻
Testing notes
I usually put screenshots and details of my testing in the notes so you can see if I missed any vital area and understand better where my comments come from. But being straight from PTO and having lots on my plate, I decided to simply report what's wrong below.
I'm happy to elaborate but everything seems straightforward!
QA checklist
isSelectedapplies a selected style only whenisSingleSelection=false
This implies when isSingleSelection=true, toggling isSelected doesn't apply selected style, right? If so, isSelected applies it no matter isSingleSelection:
isSelectedcontrols the value ofaria-currentwhenisSingleSelection(when noroleis set or a non-checkable, non-selectableroleis set, e.g. "presentation")
If I'm reading this correctly, aria-current shouldn't get set when toggling isSelected (and isSingleSelection=true), and the role is set to e.g. select:
but it is. I'd expect aria-selected.
💭 MDN says: "If the attribute is not present, is an empty string, is present with no value, or is set to aria-current="false" it is not exposed to the user". So not setting the falsy value of aria-current is okay.
checkedsetsaria-checkedcorrectly (when a checkableroleis defined, e.g. "option" whenisSingleSelection=false)
Role checkbox (and option as suggested) when checked is set to on/off produces aria-current="true" for both.
selectionModeoverrides default selection semantics
It seems like selectionMode doesn't override selection semantics... at all:
I only flipped the isSelected bool to true.
Outside the checklist
isDisabled style poor affordance
It feels like there's almost no affordance to the list item actually being disabled (it's especially confusing when the list item is selected/checked). I would expect the checkbox icon bing grey instead of blue when selected, and the background as well. cc @ek-so
extraAction is styled correctly.
Badge not aligned vertically
Badge seems to not be perfectly aligned vertically but it involves some sub-pixel computation so I guess it's fine. All paddings are correct.
No description API / styles
Figma showcases a description text of lighter color, smaller font size:
but there's no API for this. It seems like the consumer would have to use children and their own composition? Doesn't seem ideal for consistency.
Nested <li> elements
If you set component="li" AND add role="button" then isNonInteractiveComponent and isInteractiveComponent are both true 😅 if you add extraAction that produces nested <li> elements.
|
@weronikaolejniczak Thanks for the very detailed review! I'm aware this PR is quite complex, your time and notes are much appreciated ❤️ I'll go over the points you flagged one by one: 1.
|
weronikaolejniczak
left a comment
There was a problem hiding this comment.
I see, thanks for clarifying these points! I re-tested, checked recent commits and everything LGTM 🟢 This is being merged to a feature branch and things can come up later as well. Only found one more nit.
💚 Build SucceededHistory
cc @mgadewoll |
💚 Build Succeeded
History
cc @mgadewoll |




Summary
Important
This PR merges into a feature branch
closes https://github.com/elastic/eui-private/issues/548
This PR introduces a new internal component:
EuiListItemLayout.This component will be used across different EUI selection/list components, replacing the custom item implementations and creating a shared source of truth for behavior and styles.
Note
This work is part of the ongoing initiative to implement selection list UI enhancements (https://github.com/elastic/platform-ux-team/issues/1050)
There will be 5 more PRs after this one that will implement
EuiListItemLayoutinto the following components:EuiSelectable,EuiComboBox,EuiListGroup,EuiContextMenuandEuiSuperSelectComponent behaviors
EuiListItemLayoutcontrols styles, layout and semantic output for list items. It handles different variants to support different component implementations.element: renders asli,div,buttonoracheckedundefined,on,off(excluded) ormixed(indeterminate)aria-checkedattribute IF the elementrolesupports itisSelectedshowIndicator=falsearia-selectedandaria-currentvalue when applicableisSingleSelection: defines multi- vs single-selectionEuiIconas checked state indicatorisSelectedapplies a visual selected state (blue background and color)roleOR non-checkable, non-selectable role ->aria-currentrole->aria-checkedrole->aria-selectedEuiCheckboxControlas checked state indicatorisSelecteddoes not apply a visual selected styleroleOR non-checkable, non-selectable role ->aria-currentrole->aria-checkedrole->aria-selectedselectionMode: handled by default internally, but provides means to select betweenaria-checkedandaria-selectedmanually when a supported checkable/selectable role is passedisFocused: applies a "faux" focus style (matches the hover style, not regular focus style), that is used for indicating the actively navigated item in a listboxextraActionelement=button) it will render as sibling to the main interactive element to ensure valid HTML. This case requires an additional outer wrapper to be rendered (.euiListItemLayout__wrapper).elementvalue.API Changes
EuiListItemLayoutelement'li'(default),'div','button','a'. Whenelement='a'andisDisabled=true, falls back to rendering a'button'.EuiListItemLayoutchildrenEuiListItemLayoutprependEuiListItemLayoutappendextraActionfor interactive appended elements.EuiListItemLayoutextraActionelement='button'orelement='a', a wrapper element is rendered to avoid nesting interactive elements.EuiListItemLayoutwrapperElement'li'or'div'). Has no effect whenelement='li'orelement='div'. Defaults to'li'whenextraActionis present.EuiListItemLayoutwrapperPropsclassName,css,style, etc.) applied to the wrapper element. Only applies when a wrapper is rendered (i.e.wrapperElementis set orextraActionis passed).EuiListItemLayoutcontentProps<span>.EuiListItemLayouttextProps<span>.EuiListItemLayoutprependProps<span>wrapper.EuiListItemLayoutappendProps<span>wrapper.EuiListItemLayouttooltipPropsEuiToolTipwrapping the item. Tooltip is suppressed whenisDisabled=true. Forli/divcomponents the tooltip wraps the inner content; forbutton/ait wraps the element itself.EuiListItemLayoutcheckedroleis set) thearia-checkedattribute. Accepted values:'on','off','mixed',undefined.EuiListItemLayoutisSelectedaria-selected,aria-current, oraria-checkeddepending onelement,role, andselectionMode. Also applies a visual selected style whenisSingleSelection=trueorshowIndicator=false.EuiListItemLayoutisFocusedtooltipPropsis set.EuiListItemLayoutisDisableddisabledattribute forbutton,aria-disabledfor all other components). Suppresses the tooltip.EuiListItemLayoutisSingleSelectionaria-checked) and single-selection (icon indicators,aria-selected/aria-current). Defaults totrue.EuiListItemLayoutselectionModearia-checkedoraria-selectedis applied. Applies only when a supported checkable/selectableroleis passed.EuiListItemLayoutshowIndicatortrue.EuiListItemLayoutroleroleattribute. Drives which ARIA selection attribute is applied. When using a custom role that natively supports checked states, setselectionMode='checked'.EuiListItemLayouttextWrap'truncate'(default) clips with an ellipsis;'wrap'allows line breaks.EuiListItemLayouthrefhref. Only applied whenelement='a'andisDisabled=false.EuiListItemLayouttargettarget. Only applied whenelement='a'andisDisabled=false.EuiListItemLayoutrelrel. Only applied whenelement='a'andisDisabled=false.EuiListItemLayoutdata-test-subj'euiListItemLayout'. When a wrapper is rendered, the wrapper receives'<value>-wrapper'and the inner element retains'<value>'.EuiListItemLayoutclassName/css/styleCommonProps. Applied to the inner element (or to the wrapper when a wrapper is rendered).Screenshots
element="li"element="div"element="button"element="a"extraActionsibling DOM orderScreen.Recording.2026-03-25.at.10.14.25.mov
Impact Assessment
Impact level: 🟢 None (new, internal component)
Release Readiness
Documentation: {link to docs page(s)}(internal component)Migration guide: {steps or link, for breaking/visual changes or deprecations}Adoption plan (new features): {link to issue/doc or outline who will integrate this and where}QA instructions for reviewer
Links
Checks
EuiListItemLayoutmatches design specs (ideation specs, review updates)EuiselectableListItemin [EuiSelectable] UI enhancements #9411 (Storybook)elementrenders different elementsisSingleSelectioncontrols checked indicator render (EuiCheckboxControlvsEuiIcon)showIndicatorshows/hides the checked state indicatorisSelectedapplies a selected style only whenisSingleSelection=falseisSelectedcontrols the value ofaria-currentwhenisSingleSelection(when noroleis set or a non-checkable, non-selectableroleis set, e.g. "presentation")isSelectedcontrols the value ofaria-selectedwhenisSingleSelection(ensure a selectableroleis set, e.g. "option")checkedcontrols the checked state indicator variant (checked, unchecked, mixed, excluded)checkedsetsaria-checkedcorrectly (when a checkableroleis defined, e.g. "option" whenisSingleSelection=false)isFocusedapplies a highlight style (matching the hover style)extraActionresults in a nested main element (when element=button/a) with theextraActionelement being its sibling and an additional wrapper being renderedselectionModeoverrides default selection semanticswrapperElementcorrectly renders aliordivforelement=button/aisDisabledapplies a disabled style and prevents interactiontextWrap(truncation and wrap) work as expectedappendandprependtooltipPropsis passedChecklist before marking Ready for Review
QA: Tested in CodeSandbox and KibanaQA: Tested docs changesChangelog: Added changelog entryBreaking changes: Addedbreaking changelabel (if applicable)Reviewer checklist