8000 [MWPW-146354] - Geo Popup content overflow issue fix by Deva309 · Pull Request #4455 · adobecom/milo · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[MWPW-146354] - Geo Popup content overflow issue fix #4455

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

Merged
merged 6 commits into from
Jul 5, 2025
Merged
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
41 changes: 39 additions & 2 deletions libs/features/georoutingv2/georoutingv2.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,42 @@ const createTab = (content, tabName) => {
return topDiv;
};

const [handleOverflow, removeOverflow] = (() => {
let geoModal = null;
let resizeObserver = null;

const calcOverflow = () => {
if (!geoModal) return;
const isOverflowing = geoModal.scrollHeight > geoModal.clientHeight;
geoModal.style.overflow = isOverflowing ? 'auto' : 'visible';
};

return [
(container) => {
if (!container) return;
geoModal = container;

requestAnimationFrame(() => {
calcOverflow();
});

resizeObserver = new ResizeObserver(() => {
calcOverflow();
});
resizeObserver.observe(geoModal);

window.addEventListener('milo:modal:closed', removeOverflow);
},
() => {
if (!geoModal) return;
geoModal.removeAttribute('style');
if (resizeObserver) resizeObserver.disconnect();
geoModal = null;
window.removeEventListener('milo:modal:closed', removeOverflow);
},
];
})();

export const getCookie = (name) => document.cookie
.split('; ')
.find((row) => row.startsWith(`${name}=`))
Expand Down Expand Up @@ -120,6 +156,7 @@ function decorateForOnLinkClick(link, urlPrefix, localePrefix, eventType = 'Swit
|| window.location.host.endsWith('.adobe.com') ? 'domain=adobe.com' : '';
document.cookie = `international=${modPrefix};path=/;${domain}`;
link.closest('.dialog-modal').dispatchEvent(new Event('closeModal'));
removeOverflow();
});
}

Expand Down Expand Up @@ -323,7 +360,7 @@ export default async function loadGeoRouting(
);
const details = await getDetails(urlGeoData, localeMatches, json.geos.data);
if (details) {
await showModal(details);
handleOverflow(await showModal(details));
sendAnalyticsFunc(
new Event(`Load:${storedLocaleGeo || 'us'}-${urlLocaleGeo || 'us'}|Geo_Routing_Modal`),
);
Expand All @@ -339,7 +376,7 @@ export default async function loadGeoRouting(
const localeMatches = getMatches(json.georouting.data, akamaiCode);
const details = await getDetails(urlGeoData, localeMatches, json.geos.data);
if (details) {
await showModal(details);
handleOverflow(await showModal(details));
if (akamaiCode === 'gb') akamaiCode = 'uk';
sendAnalyticsFunc(
new Event(`Load:${urlLocale || 'us'}-${akamaiCode || 'us'}|Geo_Routing_Modal`),
Expand Down
Loading
0