[Bug Report] Folder Picker

When trying to use the Folder Picker, most of the time (but not every time) the folder picker dialog will immediately reopen when selecting a folder. Sometimes it minimizes to the Windows taskbar and sometimes it pops right back up on the screen. It does select the folder properly.

Just to see if it was my plugin only, I downloaded the watermark 3 plugin from the marketplace and it does the exact same thing on my computer.

Is this a known issue? If not, then I can provide more details if needed. I’m guessing it is probably already known about. However, I want to report it just in case.

var sourceFolder = await require("uxp").storage.localFileSystem.getFolder();

Just an update on this. I did some testing and figured out that the Folder Picker issue only happens when launched from an sp-button. Using a native HTML button, it works just fine.

With the sp-button, it gets stuck in an endless loop of the “click” function. It will continuous loop through the entire click function. In this example, it pops up the folder picker dialog and then updates the UI with the folder path. It continues to pop up the Folder Picker and every time it will update the UI every time too. I also tested by putting other steps in the function to confirm that it will always continually loop through the entire click function.

Here is my function. Again, this works from a regular native HTML button. The issue only occurs with the sp-button.

Hope this info helps. If this isn’t the right forum to post bugs for UXP then let me know where to post :slight_smile:

// Note: Source Folder defined as global at the beginning of the JS file
var saveFolder

document.getElementById("btnSourceFolder").addEventListener("click", async function (){
       
   sourceFolder = await require("uxp").storage.localFileSystem.getFolder();
    
   if(sourceFolder.name.length>40){document.getElementById("sourceFolderName").innerHTML="..."+sourceFolder.name.substring(sourceFolder.name.length-37,sourceFolder.name.length);}  
    
   else{document.getElementById("sourceFolderName").innerHTML=sourceFolder.name;}
        
});