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

[Core Rendering Styles] Fix bug with kibanaFullBodyHeight calculation #193798

Merged

Conversation

tsullivan
Copy link
Member

@tsullivan tsullivan commented Sep 23, 2024

A variable for the page height was not being calculated correctly when the Kibana chrome is invisible. This PR fixes the issue by adding px as a unit to a variable used as input in the calculation.

Unblocks: #193647

Testing

It will help to test within the #193647 PR branch. The following screenshots show the before and after effects of having this fix:

before
ghjkgjghgkhjgjgkjg-1

after
ghjkgjghgkhjgjgkjg-2

@tsullivan tsullivan requested a review from a team as a code owner September 23, 2024 21:04
@tsullivan tsullivan added release_note:skip Skip the PR/issue when compiling release notes v8.16.0 backport:version Backport to applied version labels labels Sep 23, 2024
@tsullivan tsullivan marked this pull request as draft September 23, 2024 22:09
@tsullivan tsullivan force-pushed the core-styles/full-height-calculation branch from 0bf86aa to 08ee079 Compare September 23, 2024 22:38
@@ -67,7 +67,7 @@
}

.kbnBody--chromeHidden {
--euiFixedHeadersOffset: 0;
--euiFixedHeadersOffset: 0px;
Copy link
Member Author

@tsullivan tsullivan Sep 23, 2024

Choose a reason for hiding this comment

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

The problem was: this calculation, which is used in Discover, was coming up wrong:

@media only screen and (min-width: 1200px) {
    .dscPage {
        // --kbnAppHeadersOffset is undefined
        // --euiFixedHeadersOffset is `0`
        height: calc(100vh - var(--kbnAppHeadersOffset, var(--euiFixedHeadersOffset, 0)));
    }
}

@cee-chen found the reason why in a spec: https://drafts.csswg.org/css-values-3/#calc-type-checking

Note: Because s are always interpreted as s or s, "unitless 0" s aren’t supported in calc(). That is, width: calc(0 + 5px); is invalid, even though both width: 0; and width: 5px; are valid.

Copy link
Member

Choose a reason for hiding this comment

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

that's very strange, it seems that this change now causes a functional test error here:

public async waitForRenderComplete(dataTestSubj?: string, timeout?: number) {
const chart = await this.getChart(dataTestSubj, timeout);
const rendered = await chart.findAllByCssSelector(
'.echChartStatus[data-ech-render-complete=true]',
timeout
);
expect(rendered.length).to.equal(1);
}

I've checked the html of the failure
Bildschirmfoto 2024-09-26 um 09 51 49
And so it failes because it seems data-ech-render-complete=false doesn't turn to true

dear @elastic/kibana-visualizations , do you have an idea what's happening here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Interesting. Does the test fail with the attribute still set to false, but the chart rendered? Or the panel is still in a loading phase?

Copy link
Member

Choose a reason for hiding this comment

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

For me it looks like it was rendered?
image

Copy link
Member

Choose a reason for hiding this comment

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

Interesting, looks like the charts now starts a redraw due to the height change.
Is not the first time I see this, where the discover heatmap is rendered 2 times because of some jumps in the layout rendering of the table.

Copy link
Member

Choose a reason for hiding this comment

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

that's is a possible workaround. I believe there is still something that needs to be anyway solved as it doesn't seems to work correctly.
I've checked locally and I can see the following:
before this PR, when switching to full screen the chart height goes to zero, and back to its height when toggling the fullscreen off. With this PR the chart remain the same size but is hidden behind the position:fixed table. This, for some reason I don't understand cause a trigger in the ResizeObserver we are using to compute the chart size causing it to turn the rendered off, but doesn't trigger it again. I can investigate a bit more if you want

Copy link
Member

Choose a reason for hiding this comment

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

ok, the way I see it, yes, it's related to the data grid going to full screen, and with the changes of this PR, as you said, the chart remains same size. For me it seems like we could try to remove the await this.testSubjects.click('dataGridFullScreenButton'); , check for flakiness, and if there's no quick fix for the ResizeObserver not being triggered again (which shold be investigated I think), open an issue to track this

Copy link
Member

Choose a reason for hiding this comment

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

@kertal @tsullivan not sure if this is a bug in Charts or in ResizeObserver (that triggers a size change even if there is no size change in the chart), but I've created a PR to fix this in charts.
I will merge the fix in charts, and push an upgraded charts version in Kibana today if possible

elastic/elastic-charts#2534

Copy link
Member

Choose a reason for hiding this comment

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

Awesome 🎉 thx!

Copy link
Member

Choose a reason for hiding this comment

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

Sorry for the late work on that, we finally manage to fix the bug in charts, and we are now waiting for a CI to pass before merging the charts dependency update in Kibana #194794
Please do a bootstrap locally if you want to see and test the changes

@tsullivan tsullivan force-pushed the core-styles/full-height-calculation branch from 08ee079 to 1c56a35 Compare September 23, 2024 23:23
@tsullivan tsullivan marked this pull request as ready for review September 23, 2024 23:25
@elastic elastic deleted a comment from kibana-ci Sep 23, 2024
Copy link
Contributor

@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.

Thanks so much for identifying the fix Tim!

Copy link
Contributor

@Dosant Dosant left a comment

Choose a reason for hiding this comment

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

Nice!

@Dosant
Copy link
Contributor

Dosant commented Sep 24, 2024

@elasticmachine merge upstream

@tsullivan
Copy link
Member Author

@kibanamachine
Copy link
Contributor

Flaky Test Runner Stats

🟠 Some tests failed. - kibana-flaky-test-suite-runner#7007

[❌] test/functional/apps/discover/group1/config.ts: 0/50 tests passed.

see run history

@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
core 455.7KB 455.7KB +4.0B

History

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

@tsullivan
Copy link
Member Author

@kibanamachine
Copy link
Contributor

Flaky Test Runner Stats

🎉 All tests passed! - kibana-flaky-test-suite-runner#7092

[✅] test/functional/apps/discover/group1/config.ts: 50/50 tests passed.

see run history

@tsullivan tsullivan merged commit 1df458d into elastic:main Oct 4, 2024
24 checks passed
@tsullivan tsullivan deleted the core-styles/full-height-calculation branch October 4, 2024 21:01
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.x

https://github.com/elastic/kibana/actions/runs/11186908856

@tsullivan
Copy link
Member Author

Thanks so much @markov00 for handling the chart issue!

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Oct 4, 2024
…elastic#193798)

A variable for the page height was not being calculated correctly when
the Kibana chrome is invisible. This PR fixes the issue by adding `px`
as a unit to a variable used as input in the calculation.

Unblocks: elastic#193647

## Testing
It will help to test within the
elastic#193647 PR branch. The following
screenshots show the before and after effects of having this fix:

**before**

![ghjkgjghgkhjgjgkjg-1](https://github.com/user-attachments/assets/d684bc77-dcc0-40ef-9271-8ae198582eea)

**after**

![ghjkgjghgkhjgjgkjg-2](https://github.com/user-attachments/assets/5198cc43-b721-4ce8-92f0-0b2bac9f5eb5)

Co-authored-by: Elastic Machine <[email protected]>
Co-authored-by: Marco Vettorello <[email protected]>
(cherry picked from commit 1df458d)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Oct 4, 2024
…lation (#193798) (#195146)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Core Rendering Styles] Fix bug with kibanaFullBodyHeight calculation
(#193798)](#193798)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Tim
Sullivan","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-04T21:00:57Z","message":"[Core
Rendering Styles] Fix bug with kibanaFullBodyHeight calculation
(#193798)\n\nA variable for the page height was not being calculated
correctly when\r\nthe Kibana chrome is invisible. This PR fixes the
issue by adding `px`\r\nas a unit to a variable used as input in the
calculation.\r\n\r\nUnblocks:
https://github.com/elastic/kibana/pull/193647\r\n\r\n## Testing\r\nIt
will help to test within
the\r\nhttps://github.com//pull/193647 PR branch. The
following\r\nscreenshots show the before and after effects of having
this
fix:\r\n\r\n**before**\r\n\r\n![ghjkgjghgkhjgjgkjg-1](https://github.com/user-attachments/assets/d684bc77-dcc0-40ef-9271-8ae198582eea)\r\n\r\n**after**\r\n\r\n![ghjkgjghgkhjgjgkjg-2](https://github.com/user-attachments/assets/5198cc43-b721-4ce8-92f0-0b2bac9f5eb5)\r\n\r\nCo-authored-by:
Elastic Machine
<[email protected]>\r\nCo-authored-by: Marco
Vettorello
<[email protected]>","sha":"1df458d2d605f5a3281c3b18bda9f433d41a7c05","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","v8.16.0","backport:version"],"title":"[Core
Rendering Styles] Fix bug with kibanaFullBodyHeight
calculation","number":193798,"url":"https://github.com/elastic/kibana/pull/193798","mergeCommit":{"message":"[Core
Rendering Styles] Fix bug with kibanaFullBodyHeight calculation
(#193798)\n\nA variable for the page height was not being calculated
correctly when\r\nthe Kibana chrome is invisible. This PR fixes the
issue by adding `px`\r\nas a unit to a variable used as input in the
calculation.\r\n\r\nUnblocks:
https://github.com/elastic/kibana/pull/193647\r\n\r\n## Testing\r\nIt
will help to test within
the\r\nhttps://github.com//pull/193647 PR branch. The
following\r\nscreenshots show the before and after effects of having
this
fix:\r\n\r\n**before**\r\n\r\n![ghjkgjghgkhjgjgkjg-1](https://github.com/user-attachments/assets/d684bc77-dcc0-40ef-9271-8ae198582eea)\r\n\r\n**after**\r\n\r\n![ghjkgjghgkhjgjgkjg-2](https://github.com/user-attachments/assets/5198cc43-b721-4ce8-92f0-0b2bac9f5eb5)\r\n\r\nCo-authored-by:
Elastic Machine
<[email protected]>\r\nCo-authored-by: Marco
Vettorello
<[email protected]>","sha":"1df458d2d605f5a3281c3b18bda9f433d41a7c05"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/193798","number":193798,"mergeCommit":{"message":"[Core
Rendering Styles] Fix bug with kibanaFullBodyHeight calculation
(#193798)\n\nA variable for the page height was not being calculated
correctly when\r\nthe Kibana chrome is invisible. This PR fixes the
issue by adding `px`\r\nas a unit to a variable used as input in the
calculation.\r\n\r\nUnblocks:
https://github.com/elastic/kibana/pull/193647\r\n\r\n## Testing\r\nIt
will help to test within
the\r\nhttps://github.com//pull/193647 PR branch. The
following\r\nscreenshots show the before and after effects of having
this
fix:\r\n\r\n**before**\r\n\r\n![ghjkgjghgkhjgjgkjg-1](https://github.com/user-attachments/assets/d684bc77-dcc0-40ef-9271-8ae198582eea)\r\n\r\n**after**\r\n\r\n![ghjkgjghgkhjgjgkjg-2](https://github.com/user-attachments/assets/5198cc43-b721-4ce8-92f0-0b2bac9f5eb5)\r\n\r\nCo-authored-by:
Elastic Machine
<[email protected]>\r\nCo-authored-by: Marco
Vettorello
<[email protected]>","sha":"1df458d2d605f5a3281c3b18bda9f433d41a7c05"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Tim Sullivan <[email protected]>
tiansivive pushed a commit to tiansivive/kibana that referenced this pull request Oct 7, 2024
…elastic#193798)

A variable for the page height was not being calculated correctly when
the Kibana chrome is invisible. This PR fixes the issue by adding `px`
as a unit to a variable used as input in the calculation.

Unblocks: elastic#193647

## Testing
It will help to test within the
elastic#193647 PR branch. The following
screenshots show the before and after effects of having this fix:

**before**

![ghjkgjghgkhjgjgkjg-1](https://github.com/user-attachments/assets/d684bc77-dcc0-40ef-9271-8ae198582eea)

**after**

![ghjkgjghgkhjgjgkjg-2](https://github.com/user-attachments/assets/5198cc43-b721-4ce8-92f0-0b2bac9f5eb5)

Co-authored-by: Elastic Machine <[email protected]>
Co-authored-by: Marco Vettorello <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:version Backport to applied version labels release_note:skip Skip the PR/issue when compiling release notes v8.16.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants