Dear Support-Team,
I use the the
Blazor Menu Bar Component in my fixed navbar.
The following issue occurs: When the page is scrolled down and I click a menu item, the page is scrolled up.
I expect the scroll to stay at the same position and the dropdown to rather be an overlay.
How to reproduce in a minimal example:
<nav class="navbar fixed-top navbar-expand-xl navbar-custom navbar-dark py-0 px-1">
<div class="container-fluid px-0">
<SfMenu ShowItemOnClick="true" CssClass="ms-auto" TValue="MenuItem" >
<MenuItems>
<MenuItem Text="DropdownMenu">
<MenuItems>
<MenuItem Text="Navlink One"></MenuItem>
<MenuItem Separator="true"></MenuItem>
<MenuItem Text="Navlink Two"></MenuItem>
</MenuItems>
</MenuItem>
</MenuItems>
</SfMenu>
</div>
</nav>>
MainLayout.razor
@inherits LayoutComponentBase
<PageTitle>SfMenuBugShowCase</PageTitle>
<div class="page">
<div>
<NavMenu />
</div>
<main>
<article style="height: 2000px;" class="content px-4">
@Body
</article>
</main>
</div>
Then scroll down a bit and click the menu item on the top right corner. This will trigger the page to scroll up.
How do I change the behaviour so that the dropdown is openend as an overlay and does not scroll the page?
Best regards,
Henning Krause
Hey Gayathri,
any updates yet?
Best regards,
Henning
Hey Gayathri,
any updates yet?
Best regards,
Henning
|
<style>
.e-menu-container.e-menu-popup.ms-auto{
position:fixed;
}
</style> |
Hello,
I have the same issue, and the position:fixed code didn't work.
Do you know a work around or an out of the box solution for this?
Thanks
Hello,
Thanks for your reply. The position:fixed breaks my full navigation and the dropdown list doesn't show up fully. I have a long list for a dropdown and I would like to scroll without the top navigation scrolling up.
The version I use is 19.4.0.38 and I use SfMenu and MenuTemplates. At the moment it is not possible to share a video of the error. I hope for a solution.
Thank you.
|
<SfMenu ShowItemOnClick="true" EnableScrolling="true" CssClass="ms-auto" TValue="MenuItem">
<MenuEvents TValue="MenuItem" OnOpen="@beforeOpenHandler"></MenuEvents>
</MenuItems>
</MenuItem>
</MenuItems>
</SfMenu>
@code
{
private void beforeOpenHandler(BeforeOpenCloseMenuEventArgs<MenuItem> e)
{
if (e.ParentItem.Text == "DropdownMenu")
e.ScrollHeight = 320;
}
} |
|
<style>
body {
position: relative;
overflow: hidden;
}
.page {
height: 100vh;
}
.page-header nav{
height: 40px;
background-color: gray;
}
.page-content {
overflow-y: auto;
margin-top: 40px;
width: 100%;
}
.e-contextmenu-container.ms-auto {
z-index: 10001 !important;
}
</style> |
I want to use style isolation in the razor.css file, is there any way to do that?
I tried deep but it was not successful.
Hi Knox Ngo,
Based on the details you’ve shared, it seems that you are trying to apply custom styles to the menu items in the Menu Bar component. As a suggestion, we recommend referring to our documentation, which provides styling options and examples for customizing menu items:
We’ve also attached a sample for your reference that shows how to apply styles to menu items using standard CSS.
Sample: Attached as a zip file.
If our understanding doesn’t match your exact use case, please feel free to correct us. To assist you better, could you kindly share more details, such as:
This
will help us provide a more accurate solution tailored to your requirement.
Regards,
Saravanan J