[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;}
        
});

Photoshop 22.1.0 / UXP dev Tools 1.0.23 /
Got the same issue using fs.getFolder(); using sp-action-button
<sp-action-button onClick={getSettingsFolder}> ,

I’m using React based on the context of the last version of ui-react-starter,

 const [path, setPath] = useState("");
  
  async function getSettingsFolder() {
    const folder = await fs.getFolder(); 
          /* ... errors .... */
      if (folder.isEntry) {
        setPath(() => folder.name);
      }
  }

Finally your solution to use a simple <button> works,
but I’ve spend a lot of time to find this tip.
Now it works !! :+1:

There’s also a little information about this bug on this thread: XD 36: Spectrum UXP, Manifest Changes, UXP Developer Tool Access, and new Layout APIs - #3 by kerrishotts