Close RadzenMenu After Pressed on Mobile Device

On a desktop computer, the RadzenMenu automatically closes when a menu item is selected. However, on a Mobile Device, the menu shows and "X" in the upper right-hand side of the menu and doesn't close. You have to click on the "X" to make it close.

Is there a way to automatically close it without clicking the "X" via blazor?

Thanks.

1 Like

Hi @MirageJb,

There is no way to do that at the moment.

Thank you for your response.

Do you know if this will be a future enhancement?

We don’t have such feature planned.

Thank you. If you can ever think of way to do this, either within blazor or javascript, please let me know.

Regards.

He guys!
I agree with this. Please watch to see why this would be a great addition.

I was looking at the GitHub repo, couldn't you just make the following a Parameter? Then we could update this from the menu's parent.

private bool IsOpen { get; set; } = false;

Hey @Julian_Dormon

Feel free to submit pull request! We will review your implementation and if it works well we will merge it.

Thanks, I was just looking how to do that.

I downloaded the repo but could not figure out how to create a new pull request. I received an OAuth app authentication error so I went ahead and made the change in my own project. If you wouldn't mind watching. It is a tiny code change.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests

Thanks. I'm not sure how I get past this error I receive when trying to create a pull request?

Can't create a new pull request: Although you appear to have the correct authorization credentials, the radzenhq organization has enabled OAuth App access restrictions, meaning that data access to third-parties is limited. For more information on these restrictions, including how to enable this app, visit Managing OAuth access to your organization's data - GitHub Docs

Hey @Julian_Dormon,

GitHub authorization is not related to Radzen organization, it’s how GitHub works. Check the link I’ve posted, you should fork the repo in order to create pull requests.

Sorry it's my first time. Forking first makes more sense. Thank you!

For anyone wanting a quick fix for this, you can simulate the click to close the menu using javascript interop.

// Simulate button click on mobile open menu, so it closes automatically when a nav link is clicked.

    window.simulateClick = function() {
        console.log('simulateClick');
        var menu = document.querySelector('.rz-menu.rz-menu-open');
        if (menu) {
            console.log('simulateClick > menu found');
            var button = menu.querySelector('.rz-menu-toggle');
            if (button) {
                console.log('simulateClick > button found');
                button.click();
            }
        }
    }