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
Bugfix: Add proper padding when scrolling is added to bar gauge #32411
Conversation
@@ -102,11 +102,22 @@ div.flot-text { | |||
width: 100%; | |||
flex-grow: 1; | |||
height: calc(100% - #{$panel-header-height}); | |||
overflow: hidden; |
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.
Note: this feels a bit dangerous. Do you know about any use cases that might introduce a bug by adding this code? @torkelo
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 breaks the dropdown select in Table panel, if we had a proper portal for Select component that could solve that
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.
hmm, damn...so I need to rethink this a bit.
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.
@torkelo I changed so we use the portal functionality of react-select...not sure if this is the best way to proceed but I didn't need to do so much work to get it in place.
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.
Let me know if you think this is something we should proceed with. I will wait with fixing the tests until I got a 👍🏻
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.
And I guess we want to support horizontal scrolling as well.
public/sass/pages/_dashboard.scss
Outdated
margin-bottom: $panel-padding; | ||
} | ||
|
||
&--no-padding.panel-content--scrollable-y { |
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.
Note: can I write this in some better way using sass?
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.
&--no-padding.panel-content--scrollable-y { | |
&--no-padding#{&}--scrollable-y { |
might do the trick :)
Summary: However that resulted in the following issue in scenarios where we have a selector in a modal. That was solved by increasing the zIndex of the select menu portal to same as the modal. The benefit of doing this is that we also squash a bunch of bugs where we use the selector in e.g. transformations etc where we currently have forced the selector to open downwards to prevent it from being hidden. But again, increasing the zIndex feels like a slippery slope. I can think of one scenario (not sure if it is a valid one) where having the same (or higher) zIndex of the select menu portal and the modal is if we want to have an open select but still present a modal on top of it. Would love some feedback on this @grafana/grafana-frontend-platform 🙏🏻 Edit Edit 2 |
const scrollableYMargin = plugin.scrollableY ? theme.panelPadding : 0; | ||
const innerPanelHeight = height - headerHeight - chromePadding * 2 - PANEL_BORDER - scrollableYMargin; | ||
const panelContentClassNames = classNames({ | ||
'panel-content': true, | ||
'panel-content--no-padding': plugin.noPadding, | ||
'panel-content--scrollable-y': plugin.scrollableY, |
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.
Not sure we need this special logic. and If plugin.scrollable is true we should wrap the component in a CustomScrollbar
…to mckn/bar-gauge-scroll
Wohoo! Select issues, don't you just love them? 😁 |
Awesome findings @dprokop! I think for some of this issues we probably need to expose a "usePortal" property on the select component so you can control that depending on the context. It doesn't feel good but it might be the way to go. |
What this PR does / why we need it:
Prior to this PR the scrollbar will hide the values in the bar gauge (and probably other visualizations). I added a setScrollable to apply the scrolling in the PanelChrome instead of in the
vizRepeater
which results in getting the padding in the right place for all browsers.Which issue(s) this PR fixes:
Fixes #32083
Special notes for your reviewer:
I'm a bit concerned about adding the
overflow: hidden
to the.panel-content
. Have done some testing and think it should be fine but still changing that component feels a bit dangerous.