We have created a Shopify App which is used to render a popup on the Product Page of a Merchant's store. The popup uses fixed positioning and elevated z-index which should render it above all of the other components on the page.
When the block is inserted on a product page of a store using the Dawn theme, the CSS is not respected and instead the popup displays relative to its parent container (which is generated by Shopify due to it being inside an App section - this appears to be default Shopify behaviour and cannot be overridden.
Theme Block Code
{%- render 'upsell_popup_styles' -%}
<script src="{{ 'upsell_popup_script.js' | asset_url}}" ></script>
<div class="marca_atc_modal__backdrop marca_atc_modal__container-display-none" id="marca_atc_modal__container-id">
<div class="marca_atc_modal__modal-container">
{% render 'upsell_popup_product_card' %}
</div>
</div>
{% schema %}
{
"name": "Upsell Popup",
"target": "section"
}
{% endschema %}
CSS
<style>
.marca_atc_modal__container-display-none {
display: none;
}
.marca_atc_modal__backdrop {
width: 100vw;
height: 100vh;
position: fixed!important;
top: 0;
left: 0;
background-color: rgba(0,0,0,0.5);
padding: 100px;
z-index: 1000;
}
.marca_atc_modal__modal-container {
background-color: white;
border-radius: 5px;
padding: 10px;
box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.75);
position: absolute!important;
z-index: 1001;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
height: 70%;
width: 70%;
}
...
</style>
Interestingly, when unchecking 'Reveal sections on scroll' inside 'Theme Settings' in the theme configurator, the issue goes away. Whilst this is a workaround for development, it is not an ideal solution for merchants to have to disable this feature to simply use an app block.
Turbo Multi-language Translator
Make the better internet purchasing globaly
Turbosify SEO Speed Booster
5.0 (7)•Free plan available
Get better conversions by improving store loading speed
Installed
Turbo Multi-language Chat - AI Customer service in one hand