Unable to open modal or panel when deployed as a webpart in Sharepoint online 2013 Modern view page

%3CLINGO-SUB%20id%3D%22lingo-sub-290998%22%20slang%3D%22en-US%22%3EUnable%20to%20open%20modal%20or%20panel%20when%20deployed%20as%20a%20webpart%20in%20Sharepoint%20online%202013%20Modern%20view%20page%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-290998%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20created%20a%20web%20part%20in%20react%20js%20which%20contains%20a%20Microsoft%20office%20UI%20fabric%20control%20%22Modal%22%20and%20it%20pop%20outs%20on%20a%20button%20click.%20This%20feature%20works%20fine%20on%20my%20local%20workbench%20but%20whenever%20I%20deployed%20it%20as%20an%20app%20on%20sharepoint%20online%20and%20add%20as%20a%20web%20part%20in%20modern%20view%20page.%26nbsp%3BThings%20happen%20something%26nbsp%3Blike%26nbsp%3Bdescribed%20in%20the%20below%26nbsp%3Bimages%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20980px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F60644iF28359479E053233%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22add%20webpart.png%22%20title%3D%22add%20webpart.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F60642i76CBAD1D9F5CCDB3%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22button-request%20form.png%22%20title%3D%22button-request%20form.png%22%20%2F%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F60643iB81A53CBFB0E6B5A%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22form.png%22%20title%3D%22form.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EInstead%20of%20coming%20infront%20of%20the%20page%20it%20opens%20in%20the%20area%20allocated%26nbsp%3Bto%20the%20webpart.%20However%2C%20after%20further%20analysis%2C%20I%20come%20to%20know%20that%20sharepoint%20add%26nbsp%3Bthis%20whole%20webpart%20into%20an%20iframe%20and%20set%20its%20height%20according%20to%20the%20height%20of%20the%20webpart%20section%20and%20same%20goes%20with%20the%20Microsoft%20UI%20fabric%20panel.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20965px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F60645i95A40BC5D367B0F3%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22source%20code%20iframe.png%22%20title%3D%22source%20code%20iframe.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20want%20to%20know%20that%20is%20there%20a%20way%20that%20I%20can%20make%26nbsp%3Bmodal%20or%20panel%20work%20as%20desired%20when%20deployed%20as%26nbsp%3B%20a%20webpart%20in%20modern%20view%20SharePoint.%20However%2C%20it%20works%20when%20I%20deployed%20it%20as%20an%20extension%20(but%20that%20isn't%20my%20business%20requirement).%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-290998%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3E2013%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EModal%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPanel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESharePoint%20Framework%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESharePoint%20Online%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESharePoint%20Server%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1046665%22%20slang%3D%22en-US%22%3ERe%3A%20Unable%20to%20open%20modal%20or%20panel%20when%20deployed%20as%20a%20webpart%20in%20Sharepoint%20online%202013%20Modern%20view%20p%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1046665%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F246003%22%20target%3D%22_blank%22%3E%40zainkhan%3C%2FA%3E%26nbsp%3B-%20the%20answer%20comes%20very%20late%2C%20but%20the%20issue%20you%20describe%20frustrated%20me%20over%20the%20last%20days%2C%20and%20I%20hope%20I%20can%20spare%20someone%20the%20grief.%26nbsp%3B%3CBR%20%2F%3E%3CBR%20%2F%3EThe%20problem%20you%20actually%20have%2C%20is%20caused%20by%20the%20fact%20you%20are%20running%20the%20webparts%20in%20domain%20isolation%20mode%20-%20hence%20the%20whole%20IFRAME%20stuff.%26nbsp%3B%3CBR%20%2F%3E%3CBR%20%2F%3EDisabling%20this%20is%20as%20simple%20as%20going%20to%3A%20%2Fconfig%2Fpackage-solution.json%20and%20modifying%20isDomainIsolated%20to%20false.%26nbsp%3B%3CBR%20%2F%3E%3CBR%20%2F%3EThe%20tricky%20part%20-%20and%20what%20made%20me%20climb%20all%20the%20office%20walls%20here%20-%20was%20that%20even%20after%20changing%20the%20property%2C%20repacking%20and%20redeploying%20the%20solution%20to%20the%20app%20catalog%20-%20I%20was%20still%20getting%20the%20iframes.%26nbsp%3B%3CBR%20%2F%3E%3CBR%20%2F%3ETurns%20out%20(yeah%2C%20i%20know%20-%20i%20am%20stupid%2C%20took%20me%20one%20day%20to%20notice%20this)%20you%20need%20to%20fully%20remove%20the%20solution%20and%20redeploy%20it%20to%20the%20app%20catalog.%20Only%20then%20will%20it%20stop%20running%20in%20domain%20isolated%20mode.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Visitor

I have created a web part in react js which contains a Microsoft office UI fabric control "Modal" and it pop outs on a button click. This feature works fine on my local workbench but whenever I deployed it as an app on sharepoint online and add as a web part in modern view page. Things happen something like described in the below images:

 

add webpart.png

button-request form.pngform.png

 

 

Instead of coming infront of the page it opens in the area allocated to the webpart. However, after further analysis, I come to know that sharepoint add this whole webpart into an iframe and set its height according to the height of the webpart section and same goes with the Microsoft UI fabric panel. 

 

source code iframe.png

 

I want to know that is there a way that I can make modal or panel work as desired when deployed as  a webpart in modern view SharePoint. However, it works when I deployed it as an extension (but that isn't my business requirement).

1 Reply

@zainkhan - the answer comes very late, but the issue you describe frustrated me over the last days, and I hope I can spare someone the grief. 

The problem you actually have, is caused by the fact you are running the webparts in domain isolation mode - hence the whole IFRAME stuff. 

Disabling this is as simple as going to: /config/package-solution.json and modifying isDomainIsolated to false. 

The tricky part - and what made me climb all the office walls here - was that even after changing the property, repacking and redeploying the solution to the app catalog - I was still getting the iframes. 

Turns out (yeah, i know - i am stupid, took me one day to notice this) you need to fully remove the solution and redeploy it to the app catalog. Only then will it stop running in domain isolated mode.