[Reporting] Use the real dimensions when taking a screenshot#242127
Merged
ersin-erdal merged 9 commits intoelastic:mainfrom Nov 18, 2025
Merged
[Reporting] Use the real dimensions when taking a screenshot#242127ersin-erdal merged 9 commits intoelastic:mainfrom
ersin-erdal merged 9 commits intoelastic:mainfrom
Conversation
Contributor
|
Pinging @elastic/response-ops (Team:ResponseOps) |
nreese
approved these changes
Nov 10, 2025
Contributor
nreese
left a comment
There was a problem hiding this comment.
kibana-presentation changes LGTM - just an updated to a baseline snapshot image
code review only
darnautov
reviewed
Nov 14, 2025
|
|
||
| const layout = new PreserveLayout({} as Size); | ||
|
|
||
| const testSpy = jest.spyOn(layout, 'setPdfImageSize'); |
Contributor
There was a problem hiding this comment.
I noticed this file is missing
afterEach(() => {
jest.resetAllMocks();
});Could you please add it?
| import type { JobParamsProviderOptions } from '../share_context_menu'; | ||
|
|
||
| const getBaseParams = (objectType: string) => { | ||
| const viewportWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0); |
Contributor
There was a problem hiding this comment.
❓ Do we actually need the second part? I assume we don’t need to account for scrollbar width when taking screenshots
Suggested change
| const viewportWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0); | |
| const viewportWidth = document.documentElement.clientWidth; |
Contributor
Author
There was a problem hiding this comment.
This is for the old browsers. Looks like document.documentElement.clientWidth doesn't work for some old browsers.
Contributor
💚 Build Succeeded
Metrics [docs]Async chunks
History
|
darnautov
approved these changes
Nov 18, 2025
alexreal1314
pushed a commit
to alexreal1314/kibana
that referenced
this pull request
Nov 20, 2025
…#242127) Resolves: elastic#238028 Current reporting jobs get the dimensions of the element we want to screenshot in the params and uses them to set the viewport dimensions and the image dimensions. This causes the skewed images problem when there is another element next to the element we want to screenshot. F.I.: UI passes the element dimensions: 1200x760 - When there is **no another** element next to the target element, viewport: 1200x760 and screenshot size 1200x760. No problem. - When there is an element (100px wide) next to the target element viewport: 1200x760, screenshot size becomes: 1100x760. And when we want to add that image back into a PDF we use the params we got from the UI: 1200x760. Therefore the image becomes stretched. This PR solves this problem by using the real dimensions of the target element, by getting them during the execution. ## To verify: - Generate a PDF report for a dashboard, the screenshot in it shouldn't be stretched. - Generate a PDF report for a dashboard in a solution view, the screenshot in it shouldn't be stretched. <br> To use a solution view: `Stack Management > spaces` then edit the space you are in, `Select a solution view other than classic` - Generate a PDF report for a dashboard in a solution view with the new grid layout, the screenshot in it shouldn't be stretched. <br> Same as the above just use the below config in your kibana.yml ``` feature_flags.overrides: core.chrome.layoutType: 'grid' ```
eokoneyo
pushed a commit
to eokoneyo/kibana
that referenced
this pull request
Dec 2, 2025
…#242127) Resolves: elastic#238028 Current reporting jobs get the dimensions of the element we want to screenshot in the params and uses them to set the viewport dimensions and the image dimensions. This causes the skewed images problem when there is another element next to the element we want to screenshot. F.I.: UI passes the element dimensions: 1200x760 - When there is **no another** element next to the target element, viewport: 1200x760 and screenshot size 1200x760. No problem. - When there is an element (100px wide) next to the target element viewport: 1200x760, screenshot size becomes: 1100x760. And when we want to add that image back into a PDF we use the params we got from the UI: 1200x760. Therefore the image becomes stretched. This PR solves this problem by using the real dimensions of the target element, by getting them during the execution. ## To verify: - Generate a PDF report for a dashboard, the screenshot in it shouldn't be stretched. - Generate a PDF report for a dashboard in a solution view, the screenshot in it shouldn't be stretched. <br> To use a solution view: `Stack Management > spaces` then edit the space you are in, `Select a solution view other than classic` - Generate a PDF report for a dashboard in a solution view with the new grid layout, the screenshot in it shouldn't be stretched. <br> Same as the above just use the below config in your kibana.yml ``` feature_flags.overrides: core.chrome.layoutType: 'grid' ```
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves: #238028
Current reporting jobs get the dimensions of the element we want to screenshot in the params and uses them to set the viewport dimensions and the image dimensions. This causes the skewed images problem when there is another element next to the element we want to screenshot.
F.I.:
UI passes the element dimensions: 1200x760
When there is no another element next to the target element, viewport: 1200x760 and screenshot size 1200x760. No problem.
When there is an element (100px wide) next to the target element viewport: 1200x760, screenshot size becomes: 1100x760. And when we want to add that image back into a PDF we use the params we got from the UI: 1200x760. Therefore the image becomes stretched.
This PR solves this problem by using the real dimensions of the target element, by getting them during the execution.
To verify:
To use a solution view:
Stack Management > spacesthen edit the space you are in,Select a solution view other than classicSame as the above just use the below config in your kibana.yml