Skip to content

feat(eui): make EuiFormControlLayoutIcons top-aligned #8590

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

Conversation

weronikaolejniczak
Copy link
Contributor

@weronikaolejniczak weronikaolejniczak commented Apr 14, 2025

Summary

Relates to #8553

Before After
Screenshot 2025-04-14 at 15 22 41 Screenshot 2025-04-14 at 15 25 12

This PR updates the EuiFormControlLayoutIcons component to align icons to the top instead of the center. To do this, I apply a calculated padding-top using the formula: (control height - icon size) / 2. This value is not directly tied to controlPadding or controlCompressedPadding.

For the uncompressed variant, the calculated value happens to match controlPadding ((40px - 16px) / 2 = 12px), so there's no visual difference. However, for the compressed variant, the correct top padding should be 10px ((32px - 12px) / 2 = 10px) which doesn’t align with the standard 4-based modular scale (where the nearest value would be 8px, the value of controlCompressedPadding). We want to make it work across themes and theme overrides, so we have to avoid hard-coding values.

We have to account for cases where the border is applied to the layout group and the actual control is x - 2px. This includes icon position static, append / prepend and EuiFormControlLayoutDelimited.

Instead of fixing this only for EuiComboBox, I’ve applied the change globally to all form controls, as suggested in the original issue. See the impact details below.

Note

This update should allow us to remove the local style override introduced in Kibana PR #217132.

Additional information

Component overrides

Targeting .euiFormControlLayoutIcons class:

  • packages/eui/src/components/date_picker/date_picker_range.styles.ts:79
  • packages/eui/src/components/date_picker/date_picker.styles.ts:42
  • packages/eui/src/components/form/text_area/text_area.styles.ts:88
  • packages/eui-theme-common/src/global_styling/mixins/_form.scss:211

Component impact

  • Color Picker - eui/packages/eui/src/components/color_picker/color_picker.tsx
  • Combo Box Input - eui/packages/eui/src/components/combo_box/combo_box_input/combo_box_input.tsx
  • Date Picker - eui/packages/eui/src/components/date_picker/date_picker.tsx
  • Date Picker Range - eui/packages/eui/src/components/date_picker/date_picker_range.styles.ts
  • Super Date Picker - eui/packages/eui/src/components/date_picker/super_date_picker/super_date_picker.tsx
  • Filed Number - eui/packages/eui/src/components/form/field_number/field_number.tsx
  • Field Password - eui/packages/eui/src/components/form/field_password/field_password.tsx
  • Field Search - eui/packages/eui/src/components/form/field_search/field_search.tsx
  • Field Text - eui/packages/eui/src/components/form/field_text/field_text.tsx
  • Form Control Layout Delimited - eui/packages/eui/src/components/form/form_control_layout/form_control_layout_delimited.tsx
  • Select - eui/packages/eui/src/components/form/select/select.tsx
  • Super Select Control - eui/packages/eui/src/components/form/super_select/super_select_control.tsx
  • Text Area - eui/packages/eui/src/components/form/text_area/text_area.tsx

QA

General checklist

  • Browser QA
    • Checked in both light and dark modes
    • Checked in both MacOS and Windows high contrast modes
    • Checked in mobile
    • Checked in Chrome, Safari, Edge, and Firefox
    • Checked for accessibility including keyboard-only and screenreader modes
  • Docs site QA
  • 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
    • If applicable, file an issue to update EUI's Figma library with any corresponding UI changes. (This is an internal repo, if you are external to Elastic, ask a maintainer to submit this request)

Specific checklist

  • Verify that the icons stay top aligned in EuiComboBox with a lot of selected options
  • Verify that the icons display as expected in the affected components (the list above), both compressed and uncompressed variants, both static and absolute icon positions
    • Color Picker
    • Combo Box Input
    • Date Picker
    • Date Picker Range
    • Super Date Picker
    • Filed Number
    • Field Password
    • Field Search
    • Field Text
    • Form Control Layout Delimited
    • Select
    • Super Select Control
    • Text Area
  • (optional) Test Kibana case locally with removing local style override

@weronikaolejniczak weronikaolejniczak force-pushed the 8553-euicombobox-clear-button-alignment branch from 7acecae to cf2d048 Compare April 14, 2025 12:46
@weronikaolejniczak weronikaolejniczak self-assigned this Apr 14, 2025
@weronikaolejniczak weronikaolejniczak force-pushed the 8553-euicombobox-clear-button-alignment branch from 19c2546 to eea6cd3 Compare April 14, 2025 17:07
@weronikaolejniczak weronikaolejniczak marked this pull request as ready for review April 14, 2025 17:10
@weronikaolejniczak weronikaolejniczak requested a review from a team as a code owner April 14, 2025 17:10
@weronikaolejniczak weronikaolejniczak deleted the 8553-euicombobox-clear-button-alignment branch April 16, 2025 06:46
@weronikaolejniczak weronikaolejniczak restored the 8553-euicombobox-clear-button-alignment branch April 16, 2025 06:47
@weronikaolejniczak weronikaolejniczak marked this pull request as draft April 17, 2025 09:47
@weronikaolejniczak weronikaolejniczak force-pushed the 8553-euicombobox-clear-button-alignment branch 2 times, most recently from f7a3e8c to f600952 Compare April 17, 2025 12:40
@kibanamachine
Copy link

Preview staging links for this PR:

@weronikaolejniczak weronikaolejniczak force-pushed the 8553-euicombobox-clear-button-alignment branch from f600952 to 8d258b3 Compare April 22, 2025 12:45
@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cc @weronikaolejniczak

@elasticmachine
Copy link
Collaborator

💔 Build Failed

Failed CI Steps

History

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.

5 participants