dotnet / dotnet/aspnetcore

[Blazor] Prevent unwanted DOM merging during enhanced page updates

Open
#51,707 3 comments 4 reactions 0 assignees View on GitHub
area-blazor enhancement feature-blazor-enhanced-navigation Pillar: Complete Blazor Web Priority:1
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

There might be times when an enhanced page update results in DOM elements getting merged/recycled in an undesirable manner. This is fine in many cases but can sometimes cause strange side effects (e.g., weird CSS animations playing on merged elements).

We should consider introducing a `data-key` attribute that can be used to manually indicate that a DOM element can only be merged with another element with a matching `data-key` attribute.

A current workaround is to wrap content in an element with a unique tag name to prevent it from getting merged. This could be an unresolved custom element tag name, e.g., ``.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.