Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
line-height: calculateRem(18px);
}

&--elevated {
z-index: 10250;
}

.c-tooltip-popup {
width: 100%;
max-height: 90vh;
Expand Down
34 changes: 33 additions & 1 deletion src/bundle/ui-dev/src/modules/common/popup/popup.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
getRootDOMElement,
} from '@ibexa-admin-ui/src/bundle/Resources/public/js/scripts/helpers/context.helper';

const MODAL_Z_INDEX = 10260;
const MODAL_BACKDROP_Z_INDEX = 10250;
const CLASS_NON_SCROLLABLE = 'ibexa-non-scrollable';
const CLASS_MODAL_OPEN = 'modal-open';
const MODAL_CONFIG = {
Expand Down Expand Up @@ -37,6 +39,7 @@
extraClasses,
showTooltip,
subheader,
controlZIndex,
}) => {
const rootDOMElement = getRootDOMElement();
const modalRef = useRef(null);
Expand All @@ -56,7 +59,34 @@
latestBootstrapModal.current.hide();
}
}
}, [isVisible]);

const modalNode = modalRef.current;
const modalBackdrop = document.querySelector('.modal-backdrop');

if (!modalBackdrop || !modalNode || !controlZIndex) {
return;
}

const backdropInitialZIndex = window.getComputedStyle(modalBackdrop)['z-index'];

Check warning on line 70 in src/bundle/ui-dev/src/modules/common/popup/popup.component.js

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Prefer `globalThis` over `window`.

See more on https://sonarcloud.io/project/issues?id=ibexa_admin-ui&issues=AZrjkAWoP-kchxdAlo3y&open=AZrjkAWoP-kchxdAlo3y&pullRequest=1789
const modalInitialZIndex = window.getComputedStyle(modalNode)['z-index'];

Check warning on line 71 in src/bundle/ui-dev/src/modules/common/popup/popup.component.js

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Prefer `globalThis` over `window`.

See more on https://sonarcloud.io/project/issues?id=ibexa_admin-ui&issues=AZrjkAWoP-kchxdAlo3z&open=AZrjkAWoP-kchxdAlo3z&pullRequest=1789

modalBackdrop.style.zIndex = MODAL_BACKDROP_Z_INDEX;
modalNode.style.zIndex = MODAL_Z_INDEX;

return () => {
if (backdropInitialZIndex) {
modalBackdrop.style.zIndex = backdropInitialZIndex;
} else {
modalBackdrop.style.removeProperty('z-index');
}

if (modalInitialZIndex) {
modalNode.style.zIndex = modalInitialZIndex;
} else {
modalNode.style.removeProperty('z-index');
}
};
}, [isVisible, controlZIndex]);

useEffect(() => {
return () => {
Expand Down Expand Up @@ -196,6 +226,7 @@
extraClasses: PropTypes.string,
showTooltip: PropTypes.bool,
subheader: PropTypes.node,
controlZIndex: PropTypes.bool,
};

Popup.defaultProps = {
Expand All @@ -211,6 +242,7 @@
subtitle: null,
showTooltip: true,
subheader: null,
controlZIndex: false,
};

export default Popup;
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ import { getContentTypeName } from '@ibexa-admin-ui/src/bundle/Resources/public/
import TooltipPopup from '../../../common/tooltip-popup/tooltip.popup.component';
import DropAreaComponent from '../drop-area/drop.area.component';
import UploadListComponent from '../upload-list/upload.list.component';
import { UDWContext } from '../../../universal-discovery/universal.discovery.module';
import { createCssClassNames } from '../../..//common/helpers/css.class.names';

const CLASS_SCROLL_DISABLED = 'ibexa-scroll-disabled';

export default class UploadPopupModule extends Component {
class UploadPopupModule extends Component {
constructor(props) {
super(props);

Expand Down Expand Up @@ -47,6 +49,7 @@ export default class UploadPopupModule extends Component {
}

render() {
const isUDW = this.context;
const Translator = getTranslator();
const hasAnyUploadedItems = !!this.props.uploadedItems.length;
const hasAnyItemsToUpload = !!this.props.itemsToUpload.length;
Expand All @@ -60,6 +63,10 @@ export default class UploadPopupModule extends Component {
{},
'ibexa_multi_file_upload',
);
const className = createCssClassNames({
'c-upload-popup': true,
'c-upload-popup--elevated': !!isUDW,
});
const {
addItemsToUpload,
subtitle,
Expand Down Expand Up @@ -120,7 +127,7 @@ export default class UploadPopupModule extends Component {
}

return (
<div className="c-upload-popup" ref={this.refTooltip}>
<div className={className} ref={this.refTooltip}>
<TooltipPopup {...tooltipAttrs}>
<div className="c-upload-popup__label">{label}</div>
<DropAreaComponent
Expand Down Expand Up @@ -184,3 +191,7 @@ UploadPopupModule.defaultProps = {
onAfterDelete: () => {},
enableUploadedItemEdit: true,
};

UploadPopupModule.contextType = UDWContext;

export default UploadPopupModule;
Loading