I'm using Blazored Modal modals in a Blazor server app and the modals are positioned above the calling page rather than overlaying it.
App.razor:
<CascadingAuthenticationState>
<CascadingBlazoredModal Class="custom-blazored-modal">
<Router AppAssembly="@typeof(Program).Assembly">
<Found Context="routeData">
<AuthorizeRouteView RouteData="@routeData" DefaultLayout="@typeof(GridLayout)" />
</Found>
<NotFound>
<LayoutView Layout="@typeof(GridLayout)">
<p>Sorry, there's nothing at this address.</p>
</LayoutView>
</NotFound>
</Router>
</CascadingBlazoredModal>
</CascadingAuthenticationState>
site.css:
.custom-blazored-modal {
display: flex;
z-index: 102;
flex-direction: column;
background-color: #F5EFE7;
border-radius: 0px;
border: 4px solid #660624;
width: 100%;
padding: 1rem;
}
Example of method to display a modal:
// Open the modal dialog to add a new notebook.
async Task AddNotebookAsync_Click()
{
// Add a notebook via a dialog.
var parameters = new ModalParameters();
var options = new ModalOptions()
{
HideCloseButton = true,
DisableBackgroundCancel = true
};
var addNotebookModal = Modal.Show<AddNotebookModal>(null, parameters, options);
var result = await addNotebookModal.Result;
// If the user cancelled, exit.
if (result.Cancelled)
{
return;
}
this.StateHasChanged();
return;
}
Example of what is displayed:
The code appears to be virtually the same as in other apps where it works (the modal overlays the calling page). I tried changing the z-index but with no effect.

Make sure that you are using CSS Isolation in your app as that can easily be forgotten with Blazor and break many things.