Skip to content

Conversation

@tkajtoch
Copy link
Member

@tkajtoch tkajtoch commented Mar 20, 2025

Summary

This fixes EUI components having incorrect styles because of Docusaurus' defaults applied by their infima CSS library. That library defines quite a few global styles we need to programmatically remove. Until now we were patching them with yarn patch but that's not a reliable solution, and unfortunately, there's no way to let docusaurus not include these styles.

This PR adds a custom webpack configuration that omits any infima styles from being bundled, and re-applies some of the safe styles we actually need for the base docusaurus theme to render properly.

@tkajtoch tkajtoch self-assigned this Mar 20, 2025
@tkajtoch tkajtoch added the skip-changelog Use on PRs to skip changelog requirement (Don't delete - used for automation) label Mar 20, 2025
@tkajtoch tkajtoch marked this pull request as ready for review March 20, 2025 12:52
@tkajtoch tkajtoch requested a review from a team as a code owner March 20, 2025 12:52
Copy link
Contributor

@weronikaolejniczak weronikaolejniczak left a comment

Choose a reason for hiding this comment

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

Amazing idea to remove infima styles altogether, it's a meaningful solution to several issues.

Thanks for tackling this, Tomasz! 🙌🏻

Testing notes

✅ The footer is now correctly styled, always in dark mode

Screenshot 2025-03-21 at 08 18 11

EuiLink hover and active styles are no longer affected by global CSS

Screen.Recording.2025-03-21.at.08.20.11.mov

✅ [Global styles missing] EuiComboBox and EuiTreeView are as expected; combo box doesn't cut off the text in the input and the cursor as in prod in the tree view

Screenshot 2025-03-21 at 08 21 31
Screenshot 2025-03-21 at 08 21 50

❌ The alerts are unstyled now (the container styles are missing); we can fix it on another task, no problem

Screenshot 2025-03-21 at 08 21 07

Subdued background colors seem to be back!

Screenshot 2025-03-21 at 08 33 50
Screenshot 2025-03-21 at 08 34 52

❌ EuiComment - the letters are still not vertically aligned in the blue circles; we'd need to extract it to a bug ticket

Screenshot 2025-03-21 at 08 35 39

✅ EuiTimeline multiple items example no longer looks "very broken" 😄

Screenshot 2025-03-21 at 08 37 09

EuiSkeleton doesn't bounce around in height anymore, it doesn't seem like it needs tweaking either

❌ Something is happening to the rectangle skeleton though, it seems to be "bouncing" in width now; we can extract it to a separate task0

Screen.Recording.2025-03-21.at.08.38.37.mov

EuiSteps horizontal variant seems to be working as expected now

Screen.Recording.2025-03-21.at.08.41.28.mov

✅ Not sure if this is affected by your changed but EuiBottomBar Displacement example seems to be working now

EuiCodeBlock doesn't seem to suffer from font being too small compared to prod

Prod New docs
Screenshot 2025-03-21 at 08 44 20 Screenshot 2025-03-21 at 08 44 15

but I just noticed that the React import is missing 🤔 We might want to create a ticket for this.


I would make #8167 a spike, close it as @acstll has done some amazing investigation there, I would close all the above-mentioned tasks as "Duplicate" (I guess the closest to "Solved by").

Let's either fix the above-mentioned issues here or create separate tickets, in which case please link them here for awareness 🙏🏻 I can help creating them!

*/
const ignoreInfimaPlugin: PluginModule = () => ({
name: 'ignore-infima-plugin',
configureWebpack(config: any, isServer: boolean, utils: any) {
Copy link
Contributor

Choose a reason for hiding this comment

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

blocking:

We're not using these values, can we remove them?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch! Removed in 68fe775

@mgadewoll
Copy link
Contributor

❌ Something is happening to the rectangle skeleton though, it seems to be "bouncing" in width now; we can extract it to a separate task0

ℹ️ Fyi, The skeleton visual bug is unrelated to this PR. It was already addressed as part of this PR.

@weronikaolejniczak weronikaolejniczak self-requested a review March 24, 2025 11:09
@tkajtoch
Copy link
Member Author

@weronikaolejniczak I created https://github.com/elastic/eui-private/issues/269 to cover admonition styles and decided to fix EuiCommentList directly here (commit)

color: ${euiTheme.colors.emptyShade};
${useEuiFontSize('xs')};
// override due to a custom lineHeightMultiplier set
line-height: 1.14rem;
Copy link
Member Author

Choose a reason for hiding this comment

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

Line height multiplier is overridden in @elastic/eui-docusaurus-theme. Since this component is pretty much fully customized to display the circle indicators I decided to just hardcode a correct (default) value here.

@kibanamachine
Copy link

Preview staging links for this PR:

@elasticmachine
Copy link
Collaborator

elasticmachine commented Mar 24, 2025

💚 Build Succeeded

History

cc @tkajtoch

Copy link
Contributor

@weronikaolejniczak weronikaolejniczak left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for making the additional changes 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-changelog Use on PRs to skip changelog requirement (Don't delete - used for automation)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants