Skip to content

Render a component at a specific position in the DOM #10831

@Stamo-Gochev

Description

@Stamo-Gochev

As working with the DOM in Blazor has its limitations, what is the current recommendation for displaying popups like dialogs at specific positions on the page?

For example, showing a window/dialog on a button click inside a Blazor component requires the popup element to be appended to a specific element (let's say the body) in order to be displayed over all other elements on the page. However, there is also the case for showing a popup inside another popup, so basically the position might be determined based on certain conditions.

One way to solve this might be to render a "special" element by using the idea of @(await Html.RenderComponentAsync<App>()) and then use JS interop to manually move elements from their original position to the desired one. However, this will probably break the diffing algorithm.

Are there any better ways to handle this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions