Cannot hide "New folder" and "Open" in folder context menu

Hi

in the event "MenuOpened" I try to hide "New folder" and "Open" for certain folders.
"Open" is Disabled but not hidden and "New folder" remains enabled and visible

In my code I want to hide all menu items except "Details".foreach (var menuItem in args.Items)

foreach (var menuItem in args.Items)
{
    menuItem.Hidden = menuItem.Text != "Details";
}

The above code works for all menu items but not for "New folder" and "Open"

Regards, Bruno


13 Replies

PM Prasanth Madhaiyan Syncfusion Team June 4, 2026 09:38 AM UTC

Hi Bruno,

Greetings from Syncfusion Support.

Based on the information provided, we have validated and confirmed that the reported scenario, "FileManager MenuOpened: Hidden and Disabled properties not applied consistently across context menu items," is a bug on our end. The fix for this issue will be included in the next weekly patch release of Volume 2, scheduled for the end of June 2026.
 
You can track the status of the fix through the following Feedback link.


Disclaimer: The provided tentative release timeline is subject to change in the future based on development priorities and testing outcomes.

Regards,

Prasanth Madhaiyan.



BR Bruno June 4, 2026 10:14 AM UTC

Hi Prasanth

Thank you for going to fix the bug!

For my scenario it would be very advantageous if the layout, file, and folder menu items could be loaded dynamically. I tried this in MenuOpened, but it didn't work. Can you provide me with sample code? 

Regards,

Bruno



PS Praveen Sellappan Syncfusion Team June 5, 2026 10:10 AM UTC

Hi Bruno,
Thank you for reaching out
In the Syncfusion Blazor File Manager, you can define context menu items separately for files, folders, and layout using the FileManagerContextMenuSettings. This allows you to control which menu items are shown for each category.

However, the component does not support configuring completely different context menu structures for individual files or folders at design time.

To achieve more granular control, you can dynamically customize the context menu at runtime using the MenuOpened event. Within this event, the current context (file, folder, or layout) and the selected item details are available, allowing you to modify menu items as needed.

Using the MenuOpened event, you can:
  • Hide menu items using the Hidden property
  • Disable menu items using the Disabled property
For example:
  • Hide the "Cut" option when the selected folder is "Pictures"
  • Hide the "Details" option when the selected file is "snow.jpg"
  • Hide the "Paste" option when the context menu is opened on the layout
This approach enables flexible, condition-based customization of the context menu without altering the overall menu structure.

You can implement this logic inside the MenuOpened event handler to tailor the behavior according to your specific requirements.

Code Snippet:
...
<SfFileManager TValue="FileManagerDirectoryContent" @ref="FileManager">
   .....
    <FileManagerContextMenuSettings File="@FileItems" Folder="@FolderItems" Layout="@LayoutItems"></FileManagerContextMenuSettings>
    <FileManagerEvents TValue="FileManagerDirectoryContent" MenuOpened="OnMenuOpened"></FileManagerEvents>
</SfFileManager>

@code {
    SfFileManager<FileManagerDirectoryContent>? FileManager;
    public string[] FileItems = new string[] { "Delete", "Download", "Rename", "|", "Details" };
    public string[] FolderItems = new string[] { "Open", "|", "Cut", "Copy", "Paste", "Delete", "Download" };
    public string[] LayoutItems = new string[] { "Open", "|", "Cut", "Copy", "Paste", "New Folder", "Upload" };
    public void OnMenuOpened(MenuOpenEventArgs<FileManagerDirectoryContent> args)
    {
        if(args.FileDetails[0].Name == "Pictures" && args.MenuType == "Folder")
        {
            foreach(var item in args.Items)
            {
                if(item.Text =="Cut")
                {
                    item.Hidden = true;
                }
            }
        }
        if (args.FileDetails[0].Name == "snow.jpg" && args.MenuType == "File")
        {
            foreach (var item in args.Items)
            {
                if (item.Text == "Details")
                {
                    item.Hidden = true;
                }
            }
        }
        if (args.MenuType == "Layout")
        {
            foreach (var item in args.Items)
            {
                if (item.Text == "Paste")
                {
                    item.Hidden = true;
                }
            }
        }
       
    }
}

Regarding the previous discussion concerning issues with "Open" and "New Folder" menu item customization, we have logged a bug in our system to track this.
We have attached the sample for your reference. Please review it and let us know if it addresses your requirements.

Regards,

Praveen Sellappan


Attachment: FileCM_d5137120.zip


PS Praveen Sellappan Syncfusion Team June 24, 2026 04:19 AM UTC

Hi Bruno,

 

Thanks for your patience.

  

The issue  “FileManager MenuOpened: Hidden and Disabled properties not applied consistently across context menu items has been resolved in this release. To access this fix, we suggest you update the package to the latest version(33.2.15). We have also included the sample in the main version for your reference.

 

Root cause: The Hidden property was not applied consistently across all context menu rendering paths, causing items like "Open" to remain visible even when marked as hidden. Different menus used separate rendering logic that ignored the updated Hidden state. The Disable property failed because disabled items were stored using localized display text, while the UI checked against internal menu keys. This mismatch prevented items from being rendered as disabled.

Sample: Attached as a zip file.

 

Feedback: https://www.syncfusion.com/feedback/74373/filemanager-menuopened-hidden-and-disabled-properties-not-applied-consistently

 

Release Note: Essential Studio for Blazor Release Notes - v33.2.15

 

We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance.

 

Regards,

Praveen Sellappan


Attachment: BlazorFileManager_4eca7094.zip


BR Bruno June 24, 2026 08:47 AM UTC

Hi Praveen

I tested the new version and found out that is still doesn't work for the folder items.

In menuOpened I hide all items to check the result.

New folder and Upload is still visible although Hidden is true.

I also have a strange effect with a custom item: When the name is 'Change Permission' it works. But when the name is 'ChangePermission' it works not and stays visible.

Please not that I use <NavigationTemplate> to render the folder view. 

Best regards,

Bruno



PS Praveen Sellappan Syncfusion Team June 25, 2026 03:09 PM UTC

Hi Bruno,
Thank you for testing the latest version and for sharing your findings.
Based on the details you provided, we thoroughly tested the sample that we shared using the fixed version 33.2.15. During our validation, both the Hidden and Disabled properties worked as expected. We performed multiple rounds of testing and were unable to reproduce the behavior you described. We also verified the scenario using the NavigationTemplate, as mentioned in your setup.
Specifically, we tested setting the Hidden property to true for the custom menu item "ChangePermission", hiding all menu items through the Hidden property, and hiding the New Folder and Upload menu items. In all these cases, the items were hidden correctly, and the behavior matched the intended functionality. We have attached a sample video demonstrating these scenarios for your reference.
We suspect that the problem may be related to either the browser cache or the NuGet cache, especially after updating to a newer version. To help resolve the issue, we recommend removing the bin and obj folders from your project, then rebuilding and clearing your browser cache.

To assist you in this process, we have attached a blog post that provides step-by-step instructions for clearing the cache.


Try out the shared details and let us know if you need any further assistance.
Regards,
Praveen Sellappan

Attachment: contextmenu_31f561cd.zip


BR Bruno June 26, 2026 07:34 AM UTC

Hi Praveen

I cleared both caches but the problem still exists.

in MenuOpened I set:

            foreach (var item in args.Items)
            {
                item.Hidden = true;
                item.Disabled = false;
            }
            return;


Checking Dev tools elements:

<li role="menuitem" tabindex="-1" aria-label="New folder" class="e-menu-item" id="filemanager-e95363b0-2760-4031-8ecd-53f071ce4807_cm_newfolder"><span class="e-menu-icon e-icons e-fe-newfolder"></span>New folder</li>

<li role="menuitem" tabindex="-1" aria-label="New Model" class="e-menu-item e-menu-hide e-blankicon" id="filemanager-e95363b0-2760-4031-8ecd-53f071ce4807_cm_new model" style="padding-left: 38px;">New Model</li>

<li role="menuitem" tabindex="-1" aria-label="Upload" class="e-menu-item e-menu-caret-icon" id="filemanager-e95363b0-2760-4031-8ecd-53f071ce4807_cm_upload" aria-haspopup="true" aria-expanded="false"><span class="e-menu-icon e-icons e-fe-upload"></span>Upload<span class="e-icons e-caret"></span><span class="e-icons e-caret"></span></li>

<li role="menuitem" tabindex="-1" aria-label="ChangePermission" class="e-menu-item e-blankicon" id="filemanager-e95363b0-2760-4031-8ecd-53f071ce4807_cm_changepermission" style="padding-left: 38px;">ChangePermission</li>

The three items do not have e-menu-hide like at "New Model" which is really invisible.

Attached my razor file (without the partial class)



Attachment: FileManagerDialog_b967bd74.zip


BR Bruno June 26, 2026 07:45 AM UTC

Hi Praveen

I also checked your flat data sample where hiding all menu items works well.

I see a diference in the Dev Tools elements: In your sample I can not see any menu items at all. So it does not create any html code for hidden items.


Regards, Bruno










BR Bruno June 26, 2026 08:07 AM UTC

Hi Praveen

In your video you only checked the large item view but not the folder view where the problem exists.
All works well in the large item view.

Regards, Bruno



PS Praveen Sellappan Syncfusion Team June 29, 2026 12:29 PM UTC

Hi Bruno,

Based on the configuration you shared, we prepared a local sample replicating your setup. To make the sample runnable, we added the necessary code required to execute it successfully.
We tested the scenario in the latest version (33.2.15) using the MenuOpened event customization that you provided. During our testing, all menu items were hidden from the UI as expected.
Tested Scenarios
  • Context menu opening on a folder in Navigation Pane
  • Context menu opening on a folder in Large Icons view
  • Context menu opening on a file in Large Icons view
  • Context menu opening on the layout area in Large Icons view
  • Context menu opening on a folder in Details view
  • Context menu opening on a file in Details view
  • Context menu opening on the layout area in Details view
In all the above scenarios, all menu items were successfully hidden, and no menu items were visible in the context menu.
We tested the sample multiple times; however, we regret to inform you that we were unable to reproduce the issue on our end.
For your reference, we have attached the sample tested. Kindly review it and let us know your findings.
If the issue still occurs, or if we have missed anything in our implementation, please provide the following details:
  1. Are you able to reproduce the issue using the sample we have attached?
  2. Do you notice any differences between your implementation and the sample we shared?
  3. Please ensure that all Syncfusion packages are updated to the latest version.
  4. Share a video recording demonstrating the issue so that we can further investigate it.
We look forward to your response.

Regards
Praveen


Attachment: Sample_8713f7ff.zip


BR Bruno July 3, 2026 12:02 PM UTC

Hi Praveen

Thanks for your sample, which allowed me to run a few tests.

One reason for the problem is that I hide the items after the null check:

        private async Task MenuOpened(MenuOpenEventArgs<SoFileManagerDirectoryContent> args)
        {

            var fileOrFolder = args.FileDetails?.FirstOrDefault();
            if (fileOrFolder == null)
                return;

            foreach (var item in args.Items)
            {
                item.Hidden = true;
                item.Disabled = false;
            }
        }

But there's is another problem, also in your sample:

When I add "Upload":

        FolderItems = new string[] { "Cut", "Copy", "Paste", "Delete", "Rename", "Properties", "ChangePermission", "Open", "Upload"};

Upload item does not hide.

But when I add "upload" it works.

It depends on capitalization or "Upload" is handled differently by the component.


Best regards,

Bruno





PS Praveen Sellappan Syncfusion Team July 6, 2026 04:32 PM UTC

Hi Bruno,

Thank you for sharing the details.
Regarding the issue where the Upload menu item is not hidden when properties are updated dynamically, we had already identified this issue internally in the File Manager component, and the fix has been implemented.
The fix is scheduled to be included in our upcoming weekly patch release on July 9, 2026.
We have added the issue details to the feedback below. You can track the status and future updates using the provided feedback link.
Thank you for your patience.
Regards,
Praveen


PS Praveen Sellappan Syncfusion Team July 10, 2026 02:47 PM UTC

Hi Bruno,

 

Thanks for your patience.

  

We are pleased to inform you that our weekly patch release has been successfully rolled out, and the issue "Upload menu item is not hidden when properties are updated dynamically in Blazor FileManager" has been resolved in this release.


To access this fix, we suggest updating the package to version 34.1.30 We have also included the sample in the latest version for your reference.

Sample: Attached as a zip file.

Feedback: File Manager Context Menu Fails to Update Item Properties Dynamically in the MenuOpened Event in Blazor | Feedback Portal

Release Notes:  Essential Studio for Blazor Release Notes - v34.1.30


Root cause: The Upload menu item was not hidden correctly because localized menu text was used instead of the original menu keys after the MenuOpened event, preventing the item from being identified and filtered properly.

We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance.

 

Regards,

Praveen Sellappan


Attachment: FileManager_abbae493.zip

Loader.
Up arrow icon