-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[Vega] Fix element sizing issues in fullscreen mode #194330
[Vega] Fix element sizing issues in fullscreen mode #194330
Conversation
Pinging @elastic/kibana-visualizations (Team:Visualizations) |
- update tests to use client dimensions - covert test file to ts - update types for test file
const width = Math.floor(Math.max(0, dimensions?.width ?? this._container.clientWidth)); | ||
const height = Math.floor(Math.max(0, dimensions?.height ?? this._container.clientHeight)); |
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 played a bit with the PR but I see the same issue (scrollbars visible) if you just resize the panel. The PR fixes when switching to full screen, but it doesn't work for the panel resize.
I'm not sure if that was also the previous behaviour
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.
Yeah, I've seen that before too where we are throttling the size update. I'll check with older versions and see if it's the same there.
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.
Ah, that's the reason? throttling? if so we just need to just to use a debounce strategy instead of throttling.
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.
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.
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.
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's not a huge issue but it appears most visualizations are no longer debouncing resize or very little, including Lens. Should we remove the throttle/debounce altogether in vega?
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.
Also the debounce prevents re-rendering on long slow resizing of the panel.
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's not a huge issue but it appears most visualizations are no longer debouncing resize or very little, including Lens. Should we remove the throttle/debounce altogether in vega?
I believe we can remove it, resizing is not an operation that a user does continuously so it is safe even if it's triggered quickly
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.
Removed in 6965c17
💔 Build FailedFailed CI StepsTest Failures
Metrics [docs]Async chunks
Unknown metric groupsESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: |
💚 Build Succeeded
Metrics [docs]Async chunks
|
Starting backport for target branches: 8.x https://github.com/elastic/kibana/actions/runs/11224911060 |
- Fixes elastic#194011 where a Vega visualization does not respect the enclosing element dimensions. - Fixes elastic#194861 where resizing Vega visualization panel fails to update to the latest panel dimensions causing scroll bars. (cherry picked from commit 55c2fd7)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…195328) # Backport This will backport the following commits from `main` to `8.x`: - [[Vega] Fix element sizing issues in fullscreen mode (#194330)](#194330) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Nick Partridge","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-07T22:20:27Z","message":"[Vega] Fix element sizing issues in fullscreen mode (#194330)\n\n- Fixes #194011 where a Vega visualization does not respect the enclosing\r\nelement dimensions.\r\n- Fixes #194861 where resizing Vega visualization panel fails to update to the\r\nlatest panel dimensions causing scroll bars.","sha":"55c2fd7fc1ef292961d5d69d20d1711b1fbbd468","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Feature:Vega","Team:Visualizations","v9.0.0","backport:prev-minor"],"title":"[Vega] Fix element sizing issues in fullscreen mode","number":194330,"url":"https://github.com/elastic/kibana/pull/194330","mergeCommit":{"message":"[Vega] Fix element sizing issues in fullscreen mode (#194330)\n\n- Fixes #194011 where a Vega visualization does not respect the enclosing\r\nelement dimensions.\r\n- Fixes #194861 where resizing Vega visualization panel fails to update to the\r\nlatest panel dimensions causing scroll bars.","sha":"55c2fd7fc1ef292961d5d69d20d1711b1fbbd468"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/194330","number":194330,"mergeCommit":{"message":"[Vega] Fix element sizing issues in fullscreen mode (#194330)\n\n- Fixes #194011 where a Vega visualization does not respect the enclosing\r\nelement dimensions.\r\n- Fixes #194861 where resizing Vega visualization panel fails to update to the\r\nlatest panel dimensions causing scroll bars.","sha":"55c2fd7fc1ef292961d5d69d20d1711b1fbbd468"}}]}] BACKPORT--> Co-authored-by: Nick Partridge <[email protected]>
Summary
Fixes #194011 where a Vega visualization does not respect the enclosing element dimensions.
Fixes #194861 where resizing vega vis panel fails to update to the latest panel dimensions causing scroll bars.
Details
This issue stems from changes in #181543 to remove
jQuery
, specifically these changes. The issue is that$(element).width()
was replaced withelement.getBoundingClientRect().width
. In most cases these 2 values should be the same, see Determining the dimensions of elements, but here for some reason they return different values.Zight.Recording.2024-09-27.at.12.03.43.PM.mp4
Checklist