Skip to content

Commit c7aeb0a

Browse files
committed
IBX-8316: Modal for taxonomy entry assignment field displaying not perfectly with page builder
1 parent fb162c6 commit c7aeb0a

File tree

1 file changed

+33
-7
lines changed

1 file changed

+33
-7
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,38 @@
1-
const controlZIndex = (container) => {
1+
const controlZIndex = (container, listenerContainer, resetedZIndex = 'initial') => {
22
const initialZIndex = container.style.zIndex;
3-
4-
container.addEventListener('show.bs.modal', () => {
5-
container.style.zIndex = 'initial';
6-
});
7-
container.addEventListener('hide.bs.modal', () => {
3+
const finalListenerContainer = listenerContainer ?? container;
4+
const handleShowModal = () => {
5+
container.style.zIndex = resetedZIndex;
6+
};
7+
const handleCloseModal = () => {
88
container.style.zIndex = initialZIndex;
9+
};
10+
const removeControlZIndexListeners = () => {
11+
finalListenerContainer.removeEventListener('show.bs.modal', handleShowModal, false);
12+
finalListenerContainer.removeEventListener('hidden.bs.modal', handleCloseModal, false);
13+
};
14+
15+
finalListenerContainer.addEventListener('show.bs.modal', handleShowModal, false);
16+
finalListenerContainer.addEventListener('hidden.bs.modal', handleCloseModal, false);
17+
18+
return {
19+
removeControlZIndexListeners,
20+
};
21+
};
22+
23+
const controlZIndexBulk = (items) => {
24+
const storedControlZIndex = items.map((item) => {
25+
return controlZIndex(...item);
926
});
27+
const removeControlZIndexListeners = () => {
28+
storedControlZIndex.forEach((item) => {
29+
item.removeControlZIndexListeners();
30+
});
31+
};
32+
33+
return {
34+
removeControlZIndexListeners,
35+
};
1036
};
1137

12-
export { controlZIndex };
38+
export { controlZIndex, controlZIndexBulk };

0 commit comments

Comments
 (0)