-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Embedded Console] Introduce kbnSolutionNavOffset CSS variable #175348
[Embedded Console] Introduce kbnSolutionNavOffset CSS variable #175348
Conversation
Updated the SolutionNav component to set a global CSS variable, --kbnSolutionNavOffset, with the current width of the solution nav. This will allow components in Kibana to offset based on the current size of the solution nav if its rendered on the page.
Updated the embedded console to check the current chrome style and use the correct CSS variable for the side nav offset.
dbc933f
to
004ff2b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally, changes LGTM 👍
useEffect(() => { | ||
setGlobalCSSVariables({ | ||
'--kbnSolutionNavOffset': navWidth, | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this should be cleaned in the destroy callback?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had that initially, but it didn't seem to change anything so I removed it as superfluous.
Also the eui code I modeled this off of does not have a destroy callback either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it could be a problem when this variable is used with a fallback for the case when solution nav is not rendered, e.g.:
var(--kbnSolutionNavOffset, 0);
if (isMediumBreakpoint) { | ||
return isSideNavOpenOnMobile || !canBeCollapsed | ||
? `${FLYOUT_SIZE}px` | ||
: euiThemeVars.euiSizeXXL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like there is no way (or no straightforward way) to connect these widths with the widths that are actually set for the sidebar. Maybe it is worth at least adding a comment in the CSS where these widths are set, that this logic might also need an update in case the CSS is updated
like here
minWidth: isSidebarShrunk ? euiTheme.size.xxl : undefined, |
or here
width: 248px; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or maybe it is worth at least connecting them with css variable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Dosant I added variables for the sizes and added a comment about it also being set in the tsx file.
I don't think there is way to read the variables from the scss file in the tsx file at compile time without configuration changes. But if I'm wrong about that let me know.
💛 Build succeeded, but was flaky
Failed CI StepsMetrics [docs]Async chunks
Page load bundle
History
To update your PR or re-run it, just comment with: |
* main: (520 commits) Update Kibana code editor dependencies (#171720) [SLOs] Hide view in app in slo alerts table in slo details page (#175441) [api-docs] 2024-01-25 Daily api_docs build (#175502) [DOCS] Add buildkite links to doc preview comments (#175463) skip flaky suite (#175443) [Security Solution][Timeline] refactor timeline modal save timeline button (#175343) [RAM] Stack Management::Rules loses user selections when navigating back (#174954) [Security Solution][Timeline] refactor timeline modal attach to case button (#175163) Upgrade EUI to v92.1.1 (#174955) [Fleet]: Beta label is shown inconsistently while selecting proxy under Fleet settings. (#170634) [Cloud Security] Rules Combo Box filters Custom component (#175175) skip flaky suite (#175407) [Security Solution][Timeline] refactor timeline modal open timeline button (#175335) [Embedded Console] Introduce kbnSolutionNavOffset CSS variable (#175348) [Console] disable access to embedded console without dev tools capability (#175321) fix(x-pack/reporting): use FIPS-compliant ID generator `uuidv4` in Reporting plugin (#174809) [Security Solution] Data quality dashboard persistence (#173185) [RAM][Observability] Add alert fields table to Observability flyout (#174685) test: add missing await for connector table disappearance (#175430) [RAM][Maintenance Window] Fix maintenance window FE types and transforms (#173888) ...
…ic#175348) ## Summary This PR updates the Kibana `SolutionNav` component to set a global CSS variable `--kbnSolutionNavOffset` with it's current width. This is modeled off of the EUI CSS variable `--euiCollapsibleNavOffset` that can be used in Serverless to get the current width of the side nav. This will be used by the embedded dev console to ensure it is not rendered over the page side navigation, at least for pages that use the `KibanaPageTemplate` & `SolutionNav`. ### Testing The easiest way to verify this change is to check the values of `--kbnSolutionNavOffset` in the browser console, which can be done with the following command: `getComputedStyle(document.documentElement).getPropertyValue('--kbnSolutionNavOffset')` You can check this with the solution nav open and closed or on pages without a solution nav at all (`/app/home` for example)
Summary
This PR updates the Kibana
SolutionNav
component to set a global CSS variable--kbnSolutionNavOffset
with it's current width. This is modeled off of the EUI CSS variable--euiCollapsibleNavOffset
that can be used in Serverless to get the current width of the side nav.This will be used by the embedded dev console to ensure it is not rendered over the page side navigation, at least for pages that use the
KibanaPageTemplate
&SolutionNav
.Testing
The easiest way to verify this change is to check the values of
--kbnSolutionNavOffset
in the browser console, which can be done with the following command:getComputedStyle(document.documentElement).getPropertyValue('--kbnSolutionNavOffset')
You can check this with the solution nav open and closed or on pages without a solution nav at all (
/app/home
for example)