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

[EuiSuperDatePicker] Convert quick select styles to Emotion #7909

Merged
merged 11 commits into from
Jul 29, 2024

Conversation

cee-chen
Copy link
Contributor

@cee-chen cee-chen commented Jul 24, 2024

Summary

Part 3 of 3 (see #7904, #7908)

Converts EuiSuperDatePicker's quick select popover/button styles to Emotion. I strongly recommend following along by commit as I ended up creating a new internal EuiQuickSelectPanel subcomponent for styling, and also noticing a bunch of missing i18n in the refresh interval component. I also strongly recommend hiding whitespace changes while viewing diffs as there are several sets of changes that are just indentation.

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
  • Docs site QA - N/A
  • Code quality checklist
    - [ ] Added or updated jest and cypress tests
  • 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 - N/A

@cee-chen cee-chen force-pushed the emotion/super-date-picker-3 branch from 0826e0a to 4237359 Compare July 24, 2024 19:46
@cee-chen cee-chen marked this pull request as ready for review July 24, 2024 21:27
@cee-chen cee-chen requested a review from a team as a code owner July 24, 2024 21:27
Copy link
Contributor Author

@cee-chen cee-chen left a comment

Choose a reason for hiding this comment

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

Some quick intentional change notes

${logicalCSS('margin-top', euiTheme.size.s)}
${logicalCSS(
'max-height',
mathWithUnits(euiTheme.size.m, (x) => x * 12)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just wanted to highlight * 12 as an intentional change from the previous * 11 in Sass. This extra ~12px of height allows us to remove a custom CSS override in Kibana: https://github.com/elastic/kibana/blob/1a6ab7e85ad36ec17a0333568c0393b279f22fff/src/plugins/unified_search/public/query_string_input/query_bar.scss#L6-L9

>
{(quickSelectTitle: string) => (
<div aria-hidden className="euiFormLabel">
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I also wanted to highlight this as an intentional change:

Before After

The Quick select title/label now uses EuiTitle and matches the other panels instead of using a custom .euiFormLabel className (which would have been unusable once form labels were converted to Emotion).

The screen reader only vs aria-hidden text is now no longer necessary as well with a slight absolute positioning CSS hack.

cee-chen added 11 commits July 25, 2024 14:27
- not used anywhere in the EUI repo or Kibana
- much more straightforward and less custom CSS

+ replace className with a data-test-subj instead (used by several test selectors in Kibana)
- other styles in this file are kind of all over the place and needs more refactoring
- contains all the required styling without requiring other usages to set classNames directly

- should also be flexible enough for both `div` and `fieldset/legend` usage
…ubcomponent

+ refactor recently used panel to use a flex column with gap instead of margins

+ reorder imports
+ fix incorrect fieldset/legend usage - legend has to be the first child of fieldset to be usable. Plus the label isn't that helpful anyway, so let's create our own
- fixes the label looking slightly different from the other panels

+ improve fieldset/legend workaround by absolutely positioning the arrows instead

- a11y tweaks - remove extra verbose screen reader only text, but add `aria-describedby` to make up for it

+ update remaining quick select tests from Enzyme to RTL
- referencing a removed className - use data-test-subj instead
@cee-chen cee-chen force-pushed the emotion/super-date-picker-3 branch from 4237359 to 25bf162 Compare July 25, 2024 21:37
@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

Copy link
Contributor

@mgadewoll mgadewoll left a comment

Choose a reason for hiding this comment

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

I noticed a change that was actually already introduced in the first EuiSuperDatePicker Emotion conversion PR, I think it might be this change here.

Looks like the min-width changed, which results in differences for the autoRefresh variant. Was that intentional?

Screen.Recording.2024-07-26.at.09.20.52.mov

}
`,
euiQuickSelectPanel__title: css`
float: left; /* Required for fieldset/legend elements */
Copy link
Contributor

Choose a reason for hiding this comment

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

This float is now added to span as well as legend and I see this causes some differences in spacing:

Screen.Recording.2024-07-26.at.09.06.51.mov

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The new version is actually more correct - we want the <span> to render more like a display block, which float automatically does. It looks like production was missing that

@cee-chen
Copy link
Contributor Author

Looks like the min-width changed, which results in differences for the autoRefresh variant. Was that intentional?

I'm not able to repro your screencap in either local dev or on the staging PR - what browser are you on, and what are the repro steps for it?

@mgadewoll
Copy link
Contributor

mgadewoll commented Jul 29, 2024

Looks like the min-width changed, which results in differences for the autoRefresh variant. Was that intentional?

I'm not able to repro your screencap in either local dev or on the staging PR - what browser are you on, and what are the repro steps for it?

@cee-chen I opened the docs for auto-refresh and clicked the EuiSuperDatePicker input to open the popover. I see the difference for Chrome and Edge (inputs next to each other on branch vs below each other on production). In Safari and Firefox they are the same (except for expected width changes). I'm realizing now, that it might actually have been unexpected in Chrome/Edge before and it's fixed now 😄 So please disregard then!

Copy link
Contributor

@mgadewoll mgadewoll left a comment

Choose a reason for hiding this comment

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

🚢 🐈‍⬛ Thanks for clarifying those changes! LGTM 👍

@cee-chen
Copy link
Contributor Author

Oooo gotcha! They definitely should not be below each other, so huzzah for a bug unintentionally fixed!

@cee-chen cee-chen merged commit 68985df into elastic:main Jul 29, 2024
5 checks passed
@cee-chen cee-chen deleted the emotion/super-date-picker-3 branch July 29, 2024 15:58
jbudz pushed a commit to elastic/kibana that referenced this pull request Aug 1, 2024
`v95.4.0` ⏩ `v95.5.0`

_[Questions? Please see our Kibana upgrade
FAQ.](https://github.com/elastic/eui/blob/main/wiki/eui-team-processes/upgrading-kibana.md#faq-for-kibana-teams)_

---

## [`v95.5.0`](https://github.com/elastic/eui/releases/v95.5.0)

- Added `minusInSquare` and `plusInSquare` glyphs to `EuiIcon`.
([#7875](elastic/eui#7875))

**Bug fixes**

- Fixed `EuiSuperDatePicker` not correctly passing `refreshMinInterval`
from the quick select popover
([#7905](elastic/eui#7905))

**CSS-in-JS conversions**

- Converted `EuiSuperDatePicker`'s form control to Emotion;
([#7904](elastic/eui#7904))
  - Removed `$euiSuperDatePickerWidth`
  - Removed `$euiSuperDatePickerButtonWidth`
  - Removed `$euiSuperDatePickerNeedsUpdatingBackgroundColor`
  - Removed `$euiSuperDatePickerNeedsUpdatingTextColor`
  - Removed `@euiSuperDatePickerText` mixin
- Converted `EuiSuperDatePicker`'s date popover content to Emotion
([#7908](elastic/eui#7908))
- Converted `EuiSuperDatePicker`'s quick select to Emotion
([#7909](elastic/eui#7909))

---------

Co-authored-by: Elastic Machine <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants