SPFx: BaseDialog from microsoft/sp-dialog and lost focus issue

I had a strange issue while developing a new SPFx List command extension. My custom list command opens a dialog to enter some data. The dialog works perfectly for the first time. But after I had closed and opened the dialog again, I was unable to enter data in any input fields. Other UI components, like toggle or radio buttons, were not affected, and I could use them without any issue.

After digging around and inspecting the source HTML code, I discovered an iframe with id = o365shellwcssframe, as you can see in the image below.

iframe issue

This iframe has an initial CSS display style set to "block", but after reopening the dialog, the value changes to "none". I just changed the value back to block and after this, the dialog started to work as expected.

I made the adjustment during the event "BeforeOpen" inside my custom dialog component.

export class AlertDialog extends BaseDialog { ... protected onBeforeOpen(): Promise<void> { const tempFrame = document.getElementById("o365shellwcssframe"); if (tempFrame !== null) tempFrame.style.display="block"; return new Promise((resolve, reject) => { window.setTimeout(() => resolve(), 0); }); } ...

Kommentare

Beliebte Posts aus diesem Blog

Power Automate: Abrufen von SharePoint Listenelementen mit ODATA-Filter

SharePoint Online: Optimale Bildgrößen für Seiten (Teil 1)

Connect-SPOService: The remote server returned an error: (400) Bad Request