Strange bug with s-modal. Happening randomly.
Dark overlay appears when opening a modal.
This problem happened to my teammate and me today.
Update: I was able to reproduce it randomly and record a screencast.
Strange bug with s-modal. Happening randomly.
Dark overlay appears when opening a modal.
This problem happened to my teammate and me today.
Update: I was able to reproduce it randomly and record a screencast.
I reported it a couple of days ago here and @Liam-Shopify said they are working on a fix.
We have had multiple reports from merchants and can replicate it at times. Hope we get a fix soon because this affects key actions in our apps.
Thanks for sharing this @nunof
I hope they fix soon.
Please share the code snippet you are using so that we can reproduce on our side.
Sure @jzaz here is the code. Thanks for looking into it ![]()
<s-modal id="delete-modal" heading="Delete product group?">
<s-box>
<s-text>Are you sure you want to delete the group?</s-text>
<s-box paddingBlockStart="base">
<s-text tone="critical">This action cannot be undone.</s-text>
</s-box>
</s-box>
<s-button
slot="primary-action"
variant="primary"
tone="critical"
commandFor="delete-modal"
command="--hide"
onClick={deleteProductGroup}
loading={isDeleting}
>
Delete
</s-button>
<s-button
slot="secondary-actions"
variant="secondary"
commandFor="delete-modal"
command="--hide"
>
Cancel
</s-button>
</s-modal>
And this is how I trigger it
const openDeleteModal = () => {
if (!isEditMode || !id) return;
const showModal = () => document.getElementById('delete-modal').showOverlay();
shopify.saveBar.leaveConfirmation().then(showModal).catch(showModal);
};
I had this issue today, it appears to be when you use the showOverlay and hideOverlay methods.
Is there a need for these? the commandFor should manage the overlays for you.
@Luke, it also happens with commandFor only. It happens randomly with any code.
Thanks for the comment @Luke I remember I had to switch to these methods because I was experiencing some other problem with commandFor and then had to change code. And these are documented methods I think they also should work.
I have tested all possible ways, and it randomly shows up no matter how you implement it. I cannot seem to find a pattern, but my guess is that it’s some kind of race condition when hiding that overlay.
We use confirmation modals for some critical actions and have been having multiple merchant reports.
Another example here using commandFor only.
Looking into this - thanks for sharing the code
Hi Philo, we are still looking into this because the issue is intermittent.
Do you know which browser and version the merchants are using?
Hi Jzaz,
I also experienced it myself using:
Brave 1.88.132 (Official Build) (arm64)
Chromium: 146.0.7680.80
Can also replicate it on Chrome 145.0.7632.160 (Official Build) (arm64).
Thanks you all for your patience. This bug has been fixed now!
Amazing @jzaz thanks for the fix ![]()