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

[Enterprise Search] Fix Kibana beta notification nav CSS overrides leaking into other plugins #107973

Merged
merged 1 commit into from
Aug 9, 2021

Conversation

cee-chen
Copy link
Contributor

@cee-chen cee-chen commented Aug 9, 2021

Summary

  • We were previously not scoping our sidebar class due to [KibanaPageTemplate] Fix custom sidebar classes overriding kbnPageTemplate class #103715 and the 7.14 release (now merged in)
  • Because of the lack of CSS scope/specificity, loading the Enterprise Search plugin and then another plugin would cause that our Kibana/EUI CSS overrides to leak to other plugins, due to CSS not getting unloaded between plugins (Note: this might get fixed when moving to CSS-in-JS)
  • ⚠️ Note for 7.16 when we remove the beta notification: We'll want to delete beta.scss, beta.tsx, and now line 82 & 66 of shared/layout/page_template.tsx.

Before

After

Checklist

  • Enterprise Search's beta notification is still correctly positioned at the bottom of the nav bar
  • Navigating to Enterprise Search and then another plugin (e.g. Observability overview) no longer carries over any CSS

- Because we were previously not scoping our Kibana CSS overrides, loading the Enterprise Search plugin and then another plugin would cause that CSS to leak
@cee-chen cee-chen added bug Fixes for quality problems that affect the customer experience release_note:skip Skip the PR/issue when compiling release notes v7.14.0 auto-backport Deprecated - use backport:version if exact versions are needed v7.15.0 labels Aug 9, 2021
@cee-chen cee-chen requested a review from cchaos August 9, 2021 20:45
@cee-chen cee-chen requested a review from a team as a code owner August 9, 2021 20:45
@cee-chen cee-chen requested a review from a team August 9, 2021 20:45
justify-content: space-between;
.betaSidebarNotification {
.euiSideNav {
display: flex;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the same CSS properties as before, just indented. I recommend hiding whitespace changes on the diff.

I changed this from .kbnPageTemplateSolutionNav to .euiSideNav for clarity, we could hook into either class but it made the most sense for me to use .euiSideNav to match .euiSideNav__content later.

Copy link
Contributor

Choose a reason for hiding this comment

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

Just FYI, it's never really a good idea to target .eui classes, because we make changes these a bunch including the DOM structure. We don't usually consider them breaking changes since it's not a way we support custom styling.

It may be better to use absolute positioning in this case, or to request a customization option from the component itself. Even could do it in KibanaSolutionNav, where it just accepts children placed after the EuiSideNav component.

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 used absolute positioning originally (#104763), but that broke when the PR to collapse the sidebar landed. Definitely understood that it's not ideal to target EUI classes and we normally don't, but in this case since this is a temporary notification and will be removed in 7.16, I'm honestly not super worried about it and I don't think it needs to be semantically perfect since it has a specific (and fairly short) end of life. We'll definitely keep an eye out for any layout changes or issues that come up between now and 7.16!

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, no problem. Mainly knowledge sharing. Also probably a good idea to put in a specific GH issue for removing it (if one doesn't exist yet) and targeting 7.16.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Awesome call, thanks Caroline! I've opened up a draft PR for 7.16 (#108085) as well as creating an issue in our team repo (https://github.com/elastic/app-search-team/issues/1986).

Copy link
Contributor

Choose a reason for hiding this comment

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

You win!

@cee-chen cee-chen removed the v7.14.0 label Aug 9, 2021
@cee-chen cee-chen enabled auto-merge (squash) August 9, 2021 21:16
@cee-chen
Copy link
Contributor Author

cee-chen commented Aug 9, 2021

@elasticmachine run elasticsearch-ci/docs

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
enterpriseSearch 2.1MB 2.1MB +607.0B

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@cee-chen cee-chen merged commit b4dfe9a into elastic:master Aug 9, 2021
@cee-chen cee-chen deleted the beta-nav-classes branch August 9, 2021 23:04
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Aug 9, 2021
- Because we were previously not scoping our Kibana CSS overrides, loading the Enterprise Search plugin and then another plugin would cause that CSS to leak
@kibanamachine
Copy link
Contributor

💚 Backport successful

Status Branch Result
7.x

This backport PR will be merged automatically after passing CI.

kibanamachine added a commit that referenced this pull request Aug 10, 2021
…07983)

- Because we were previously not scoping our Kibana CSS overrides, loading the Enterprise Search plugin and then another plugin would cause that CSS to leak

Co-authored-by: Constance <[email protected]>
@cee-chen cee-chen added v7.14.1 auto-backport Deprecated - use backport:version if exact versions are needed and removed auto-backport Deprecated - use backport:version if exact versions are needed labels Aug 11, 2021
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Aug 11, 2021
- Because we were previously not scoping our Kibana CSS overrides, loading the Enterprise Search plugin and then another plugin would cause that CSS to leak
@kibanamachine
Copy link
Contributor

💚 Backport successful

Status Branch Result
7.14

This backport PR will be merged automatically after passing CI.

kibanamachine added a commit that referenced this pull request Aug 11, 2021
…08233)

- Because we were previously not scoping our Kibana CSS overrides, loading the Enterprise Search plugin and then another plugin would cause that CSS to leak

Co-authored-by: Constance <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated - use backport:version if exact versions are needed bug Fixes for quality problems that affect the customer experience release_note:skip Skip the PR/issue when compiling release notes v7.14.1 v7.15.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants