[ ] Enhancement
[x] Bug
[ ] Question
Please specify what version of the library you are using: [2.1.0]
New folder name is unnecessarily encoded. If you enter 'A B' as a folder name, you get 'A%20B'. Space is a valid character for a folder name, according to the documentation:
https://support.microsoft.com/en-us/office/invalid-file-names-and-file-types-in-onedrive-and-sharepoint-64883a5d-228e-48f5-b3d2-eb39e07630fa
there is no check for invalid symbols. If you create a new folder in SharePoint UI you have an error message like this:

There is no way to cancel creation of the folder once you started it (no cancel button and escape does not work)
There is no error shown in case folder is not created (just a log entry in console). If error happens, the control gets "stuck" in the "saving" mode here, "loading" is never reset: https://github.com/pnp/sp-dev-fx-controls-react/blob/dda0256dab865a47c56a971763bf44f18689a5dc/src/controls/folderExplorer/NewFolder/NewFolder.tsx#L95
There is "blunt" encoding here (should be smarter than this; it's not all "invalid URI characters" that are prohibited). More precisely, encodeURIComponent(name) seems to be a bad idea. If (2) is fixed then this encoding can be probably be just removed (in case something is wrong, the API call will throw an exception):
https://github.com/pnp/sp-dev-fx-controls-react/blob/dda0256dab865a47c56a971763bf44f18689a5dc/src/services/FolderExplorerService.ts#L104
Here a validation (errorMessage) property is probably needed, that will check proper characters. Since spfx controls don't care about 2013, the latest invalid character set can be taken, see here. And translation of that to all supported languages:
https://github.com/pnp/sp-dev-fx-controls-react/blob/84d2b5189df7c03d8caf5b84bced4bf2746b4942/src/controls/folderExplorer/NewFolder/NewFolder.tsx#L44-L49
Not quite sure how to deal with this one.. Maybe using a focus (lock) somehow? Now the thing is the focus can can close the whole dialog/sidebar where the control is located, instead of just cancelling folder creation.
I think at least the state "loading" should be reset here on exception. Ideally, there should an error message (localized) like "failed to add folder" or something that is set as errorMessage for the <TextField>
Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.
Hi @nbelyh,
I've fixed 1, 2, and 4. Please, check beta version.
For the 3 - I don't see a value of doing that as the folder is created almost instantly. Even in OOB UI when you press ESC - the dialog is closed, but the folder is still being created.
I would consider adding some events like folderCreating with ability to cancel, but not Cancel button or ESC handle.
@AJIXuMuK This is awesome! 馃槃 The third item can be thought of later, it's not critical at all, can be left as is I guess! The space character was the only critical issue here for me.
Seems to work great 馃憤
Most helpful comment
Hi @nbelyh,
I've fixed 1, 2, and 4. Please, check beta version.
For the 3 - I don't see a value of doing that as the folder is created almost instantly. Even in OOB UI when you press ESC - the dialog is closed, but the folder is still being created.
I would consider adding some events like
folderCreatingwith ability to cancel, but not Cancel button or ESC handle.