Skip to content

Commit 7db78cf

Browse files
Fix bottom bar visibility using create portal (opensearch-project#3336)
Co-authored-by: Andrey Myssak <andreymyssak@gmail.com> Signed-off-by: Sergey Myssak <sergey.myssak@gmail.com>
1 parent ca0bb8f commit 7db78cf

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

src/core/public/rendering/rendering_service.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export class RenderingService {
6464
{chromeUi}
6565

6666
<AppWrapper chromeVisible$={chrome.getIsVisible$()}>
67-
<div className="app-wrapper-panel">
67+
<div id="app-wrapper-panel" className="app-wrapper-panel">
6868
<div id="globalBannerList">{bannerUi}</div>
6969
<AppContainer classes$={chrome.getApplicationClasses$()}>{appUi}</AppContainer>
7070
</div>

src/plugins/advanced_settings/public/management_app/components/form/form.tsx

+5-9
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ import {
4747
import { FormattedMessage } from '@osd/i18n/react';
4848
import { isEmpty } from 'lodash';
4949
import { i18n } from '@osd/i18n';
50+
import { DocLinksStart, ToastsStart } from 'opensearch-dashboards/public';
51+
import { createPortal } from 'react-dom';
5052
import { toMountPoint } from '../../../../../opensearch_dashboards_react/public';
51-
import { DocLinksStart, ToastsStart } from '../../../../../../core/public';
5253

5354
import { getCategoryName } from '../../lib';
5455
import { Field, getEditableValue } from '../field';
@@ -338,7 +339,7 @@ export class Form extends PureComponent<FormProps> {
338339
renderBottomBar = () => {
339340
const areChangesInvalid = this.areChangesInvalid();
340341
return (
341-
<EuiBottomBar data-test-subj="advancedSetting-bottomBar">
342+
<EuiBottomBar data-test-subj="advancedSetting-bottomBar" position="sticky">
342343
<EuiFlexGroup
343344
justifyContent="spaceBetween"
344345
alignItems="center"
@@ -400,12 +401,7 @@ export class Form extends PureComponent<FormProps> {
400401
const { visibleSettings, categories, categoryCounts, clearQuery } = this.props;
401402
const currentCategories: Category[] = [];
402403
const hasUnsavedChanges = !isEmpty(unsavedChanges);
403-
404-
if (hasUnsavedChanges) {
405-
document.body.classList.add('osdBody--mgtAdvancedSettingsHasBottomBar');
406-
} else {
407-
document.body.classList.remove('osdBody--mgtAdvancedSettingsHasBottomBar');
408-
}
404+
const container = document.getElementById('app-wrapper-panel')!;
409405

410406
categories.forEach((category) => {
411407
if (visibleSettings[category] && visibleSettings[category].length) {
@@ -426,7 +422,7 @@ export class Form extends PureComponent<FormProps> {
426422
})
427423
: this.maybeRenderNoSettings(clearQuery)}
428424
</div>
429-
{hasUnsavedChanges && this.renderBottomBar()}
425+
{hasUnsavedChanges && createPortal(this.renderBottomBar(), container)}
430426
</Fragment>
431427
);
432428
}

0 commit comments

Comments
 (0)