Annotations: (#20720)

- Fix scrollbar when removing annotations
This commit is contained in:
Antonio Rivero Martinez 2022-08-02 17:31:48 -03:00 committed by GitHub
parent fe581a3640
commit e2206a7151
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View File

@ -26,7 +26,9 @@ import AsyncEsmComponent from 'src/components/AsyncEsmComponent';
import { getChartKey } from 'src/explore/exploreUtils';
import { runAnnotationQuery } from 'src/components/Chart/chartAction';
import CustomListItem from 'src/explore/components/controls/CustomListItem';
import ControlPopover from '../ControlPopover/ControlPopover';
import ControlPopover, {
getSectionContainerElement,
} from '../ControlPopover/ControlPopover';
const AnnotationLayer = AsyncEsmComponent(
() => import('./AnnotationLayer'),
@ -114,6 +116,11 @@ class AnnotationLayerControl extends React.PureComponent {
removeAnnotationLayer(annotation) {
const annotations = this.props.value.filter(anno => anno !== annotation);
// So scrollbar doesnt get stuck on hidden
const element = getSectionContainerElement();
if (element) {
element.style.setProperty('overflow-y', 'auto', 'important');
}
this.props.onChange(annotations);
}

View File

@ -24,7 +24,7 @@ import Popover, {
} from 'src/components/Popover';
const sectionContainerId = 'controlSections';
const getSectionContainerElement = () =>
export const getSectionContainerElement = () =>
document.getElementById(sectionContainerId)?.lastElementChild as HTMLElement;
const getElementYVisibilityRatioOnContainer = (node: HTMLElement) => {