Fabric Modal is invisible on Mobile
Bug Report
- Package version(s): (fill this out)
- Browser and OS versions: (fill this out if relevant)
Priorities and help requested:
Are you willing to submit a PR to fix? No
Requested priority: High
Products/sites affected: (if applicable)
Describe the issue:
The modal component shows just fine on all desktop browsers but when I check Safari, Chrome, and SharePoint app on IOS it is invisible. I have to click around until i find the "dismiss" button
Actual behavior:
Modal is invisible. I can scroll the content but can't click any of it until i find the invisible dismiss button
Expected behavior:
The modal should be visible.
If applicable, please provide a codepen repro:
`<Modal
isOpen={modalVisible}
onDismiss={this.hideModal}
isBlocking={true}
className={styles.modalContainer}
isDarkOverlay={true}
>
<div>{agreementText}</div>
<DefaultButton
description="Closes Modal Window"
onClick={this.hideModal}
text={buttonText}
/>
</Modal>`
for simplicity sake i removed ALL css specific to the modal and still nothing is showing.
If I visit the fabric testing page on my phone https://developer.microsoft.com/en-us/fabric#/components/modal then they show up. I assume something is going on with SharePoint? I copied the code from the fabric page and used that same code, still not visible.
Hey @devinprejean , can you clarify what environment(s) you're seeing this in and if possible which version(s) of Fabric it's associated with? Is it a publishing page in SharePoint? I also don't repro the issue on the Fabric site in Safari iOS. We can try to repro in SP if you can share a little more detail. Thanks!
Certainly. I'm in SPO communication site on Safari IOS and the IOS SharePoint app. I'm using Fabric react version ^5.67.0
Hello @devinprejean
I have encountered the same issue. I used a quick workaround:
private fixModal() {
$('body > .ms-Layer.ms-Layer--fixed > .ms-Fabric.ms-Layer-content > div').removeAttr('style');
}
I made a new component with this function firing in componentDidUpdate()
Hope it will help you. At least for now :)
Thanks @konradox for the workaround but it looks like you’re using jQuery. For us that is not an option.
Of course, you can use pure JS in your case. I had a jQuery added to a project so I used it because it is cleaner. The goal is pretty clear. You have to remove inline styles to show this modal.
Here, take a working sample:
document.getElementsByTagName('body')[0].getElementsByClassName('ms-Layer ms-Layer--fixed')[0].getElementsByClassName('ms-Fabric ms-Layer-content')[0].getElementsByTagName('div')[0].style.cssText = ''
I'm going to close this issue as we weren't able to repro it outside of SharePoint. If this is a widespread problem and there's something that needs to be changed in Fabric to avoid this issue, please let us know.