From f015fe748b9e327093502014055724eb6d9928d5 Mon Sep 17 00:00:00 2001 From: Sodbileg Gansukh Date: Mon, 21 Sep 2026 16:19:12 +0800 Subject: [PATCH] Prevent background scrolling in theme menus (#632) fixes https://linear.app/ghost/issue/DES-1207/casper-theme-menu-on-mobile-allows-for-scrolling-in-background Keep the page fixed while menus are open so touch scrolling cannot move the content underneath, and restore its position when menus close. Keep Dope's social links below the drawer content with consistent spacing and dynamic viewport sizing so Safari's toolbar does not cover them. Bump shared theme assets to 2.7.5 and update all theme references and the lockfile so the existing CI workflow publishes the fix on merge. --- assets/built/main.min.js | 2 +- assets/built/screen.css | 2 +- assets/built/screen.css.map | 2 +- package.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/assets/built/main.min.js b/assets/built/main.min.js index 6378152e6..6d2ab52ee 100644 --- a/assets/built/main.min.js +++ b/assets/built/main.min.js @@ -1 +1 @@ -function dropdown(){let n=window.matchMedia("(max-width: 767px)"),o=document.querySelector(".gh-head-menu"),s=o?.querySelector(".nav");if(s){let t=document.querySelector(".gh-head-logo"),e=s.innerHTML;n.matches&&s.querySelectorAll("li").forEach(function(t,e){t.style.transitionDelay=.03*(e+1)+"s"});let i=function(){if(!n.matches){for(var t=[];s.offsetWidth+64>o.offsetWidth&&s.lastElementChild;)t.unshift(s.lastElementChild),s.lastElementChild.remove();if(t.length){let e=document.createElement("button"),i=(e.setAttribute("class","nav-more-toggle gh-icon-btn"),e.setAttribute("aria-label","More"),e.innerHTML='',document.createElement("div"));i.setAttribute("class","gh-dropdown"),10<=t.length?(document.body.classList.add("is-dropdown-mega"),i.style.gridTemplateRows=`repeat(${Math.ceil(t.length/2)}, 1fr)`):document.body.classList.remove("is-dropdown-mega"),t.forEach(function(t){i.appendChild(t)}),e.appendChild(i),s.appendChild(e),document.body.classList.add("is-dropdown-loaded"),window.addEventListener("click",function(t){document.body.classList.contains("is-dropdown-open")?document.body.classList.remove("is-dropdown-open"):e.contains(t.target)&&document.body.classList.add("is-dropdown-open")})}else document.body.classList.add("is-dropdown-loaded")}};imagesLoaded(t,function(){i()}),window.addEventListener("load",function(){t||i()}),window.addEventListener("resize",function(){setTimeout(()=>{s.innerHTML=e,i()},1)})}}function lightbox(t){function h(t){var e=t.getAttribute("width"),i=t.getAttribute("height"),n=(!e||!i)&&t.currentSrc||t.getAttribute("src");return{src:n,msrc:n,w:e||t.naturalWidth,h:i||t.naturalHeight,el:t}}document.querySelectorAll(t).forEach(function(t){t.addEventListener("click",function(t){var e=t,t=(e.preventDefault(),document.querySelectorAll(".pswp")[0]);if(t){var i,n=[],o=0,s=e.target.closest(".kg-card");if(s)for(var r=s.previousElementSibling;r&&(r.classList.contains("kg-image-card")||r.classList.contains("kg-gallery-card"));){var a=[];r.querySelectorAll("img").forEach(function(t){a.push(h(t)),o+=1}),r=r.previousElementSibling,n=a.concat(n)}if(!s||e.target.classList.contains("kg-image")?n.push(h(e.target)):(i=!1,e.target.closest(".kg-gallery-card").querySelectorAll("img").forEach(function(t){n.push(h(t)),i||t===e.target?i=!0:o+=1})),s)for(var l=s.nextElementSibling;l&&(l.classList.contains("kg-image-card")||l.classList.contains("kg-gallery-card"));)l.querySelectorAll("img").forEach(function(t){n.push(h(t))}),l=l.nextElementSibling;var c=new PhotoSwipe(t,PhotoSwipeUI_Default,n,{bgOpacity:.9,closeOnScroll:!0,fullscreenEl:!1,history:!1,index:o,shareEl:!1,zoomEl:!1,getThumbBoundsFn:function(t){var t=n[t].el,e=window.pageYOffset||document.documentElement.scrollTop,t=t.getBoundingClientRect();return{x:t.left,y:t.top+e,w:t.width}}});c.listen("gettingData",function(t,e){var i;0 *");let e=document.createDocumentFragment(),i=[];s.forEach(function(t){t=document.importNode(t,!0);l&&(t.style.visibility="hidden"),e.appendChild(t),i.push(t)}),c.appendChild(e),a&&a(i,u);var r=o.querySelector("link[rel=next]");r&&r.href?n.href=r.href:(n.remove(),h&&h.remove())}catch(t){throw n.remove(),h&&h.remove(),t}}),u=async function(){i.getBoundingClientRect().top<=window.innerHeight&&document.querySelector("link[rel=next]")&&await n()};let o=new IntersectionObserver(async function(t){if(!e){if(e=!0,t[0].isIntersecting)if(l)await n();else for(;i.getBoundingClientRect().top<=window.innerHeight&&document.querySelector("link[rel=next]");)await n();e=!1,document.querySelector("link[rel=next]")||o.disconnect()}});t?o.observe(i):h.addEventListener("click",n)}((t,e)=>{"object"==typeof module&&module.exports?module.exports=e():t.EvEmitter=e()})("undefined"!=typeof window?window:this,function(){function t(){}var e=t.prototype;return e.on=function(t,e){var i;return t&&e&&((i=(i=this._events=this._events||{})[t]=i[t]||[]).includes(e)||i.push(e)),this},e.once=function(t,e){var i;return t&&e&&(this.on(t,e),((i=this._onceEvents=this._onceEvents||{})[t]=i[t]||{})[e]=!0),this},e.off=function(t,e){t=this._events&&this._events[t];return t&&t.length&&-1!=(e=t.indexOf(e))&&t.splice(e,1),this},e.emitEvent=function(t,e){let i=this._events&&this._events[t];if(i&&i.length){i=i.slice(0),e=e||[];var n,o=this._onceEvents&&this._onceEvents[t];for(n of i)o&&o[n]&&(this.off(t,n),delete o[n]),n.apply(this,e)}return this},e.allOff=function(){return delete this._events,delete this._onceEvents,this},t}),((t,e)=>{"object"==typeof module&&module.exports?module.exports=e(t,require("ev-emitter")):t.imagesLoaded=e(t,t.EvEmitter)})("undefined"!=typeof window?window:this,function(e,t){let s=e.jQuery,r=e.console;function a(t,e,i){if(!(this instanceof a))return new a(t,e,i);let n=t,o;(n="string"==typeof t?document.querySelectorAll(t):n)?(this.elements=(o=n,Array.isArray(o)?o:"object"==typeof o&&"number"==typeof o.length?[...o]:[o]),this.options={},"function"==typeof e?i=e:Object.assign(this.options,e),i&&this.on("always",i),this.getImages(),s&&(this.jqDeferred=new s.Deferred),setTimeout(this.check.bind(this))):r.error("Bad element for imagesLoaded "+(n||t))}(a.prototype=Object.create(t.prototype)).getImages=function(){this.images=[],this.elements.forEach(this.addElementImages,this)};let o=[1,9,11],l=(a.prototype.addElementImages=function(t){"IMG"===t.nodeName&&this.addImage(t),!0===this.options.background&&this.addElementBackgroundImages(t);var e,i,n=t.nodeType;if(n&&o.includes(n)){for(e of t.querySelectorAll("img"))this.addImage(e);if("string"==typeof this.options.background)for(i of t.querySelectorAll(this.options.background))this.addElementBackgroundImages(i)}},/url\((['"])?(.*?)\1\)/gi);function i(t){this.img=t}function n(t,e){this.url=t,this.element=e,this.img=new Image}return a.prototype.addElementBackgroundImages=function(e){var i=getComputedStyle(e);if(i){let t=l.exec(i.backgroundImage);for(;null!==t;){var n=t&&t[2];n&&this.addBackground(n,e),t=l.exec(i.backgroundImage)}}},a.prototype.addImage=function(t){t=new i(t);this.images.push(t)},a.prototype.addBackground=function(t,e){t=new n(t,e);this.images.push(t)},a.prototype.check=function(){if(this.progressedCount=0,this.hasAnyBroken=!1,this.images.length){let e=(t,e,i)=>{setTimeout(()=>{this.progress(t,e,i)})};this.images.forEach(function(t){t.once("progress",e),t.check()})}else this.complete()},a.prototype.progress=function(t,e,i){this.progressedCount++,this.hasAnyBroken=this.hasAnyBroken||!t.isLoaded,this.emitEvent("progress",[this,t,e]),this.jqDeferred&&this.jqDeferred.notify&&this.jqDeferred.notify(this,t),this.progressedCount===this.images.length&&this.complete(),this.options.debug&&r&&r.log("progress: "+i,t,e)},a.prototype.complete=function(){var t=this.hasAnyBroken?"fail":"done";this.isComplete=!0,this.emitEvent(t,[this]),this.emitEvent("always",[this]),this.jqDeferred&&(t=this.hasAnyBroken?"reject":"resolve",this.jqDeferred[t](this))},(i.prototype=Object.create(t.prototype)).check=function(){this.getIsImageComplete()?this.confirm(0!==this.img.naturalWidth,"naturalWidth"):(this.proxyImage=new Image,this.img.crossOrigin&&(this.proxyImage.crossOrigin=this.img.crossOrigin),this.proxyImage.addEventListener("load",this),this.proxyImage.addEventListener("error",this),this.img.addEventListener("load",this),this.img.addEventListener("error",this),this.proxyImage.src=this.img.currentSrc||this.img.src)},i.prototype.getIsImageComplete=function(){return this.img.complete&&this.img.naturalWidth},i.prototype.confirm=function(t,e){this.isLoaded=t;t=this.img.parentNode,t="PICTURE"===t.nodeName?t:this.img;this.emitEvent("progress",[this,t,e])},i.prototype.handleEvent=function(t){var e="on"+t.type;this[e]&&this[e](t)},i.prototype.onload=function(){this.confirm(!0,"onload"),this.unbindEvents()},i.prototype.onerror=function(){this.confirm(!1,"onerror"),this.unbindEvents()},i.prototype.unbindEvents=function(){this.proxyImage.removeEventListener("load",this),this.proxyImage.removeEventListener("error",this),this.img.removeEventListener("load",this),this.img.removeEventListener("error",this)},(n.prototype=Object.create(i.prototype)).check=function(){this.img.addEventListener("load",this),this.img.addEventListener("error",this),this.img.src=this.url,this.getIsImageComplete()&&(this.confirm(0!==this.img.naturalWidth,"naturalWidth"),this.unbindEvents())},n.prototype.unbindEvents=function(){this.img.removeEventListener("load",this),this.img.removeEventListener("error",this)},n.prototype.confirm=function(t,e){this.isLoaded=t,this.emitEvent("progress",[this,this.element,e])},(a.makeJQueryPlugin=function(t){(t=t||e.jQuery)&&((s=t).fn.imagesLoaded=function(t,e){return new a(this,t,e).jqDeferred.promise(s(this))})})(),a}),((t,e)=>{"function"==typeof define&&define.amd?define(e):"object"==typeof exports?module.exports=e():t.PhotoSwipeUI_Default=e()})(this,function(){return function(n,a){function t(t){if(T)return!0;t=t||window.event,E.timeToIdle&&E.mouseUsed&&!y&&r();for(var e,i,n=(t.target||t.srcElement).getAttribute("class")||"",o=0;o<$.length;o++)(e=$[o]).onTap&&-1