Perf improvement: Fix Cumulative Layout Shift issue in blank Blazor templates #57213
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix loading progress svg CSS positioning. This updated CSS style stops a Cumulative Layout Shift from happening during the render of the default Blazor templates.
Fix Cumulative Layout Shift issue in blank Blazor templates
Summary of the changes (Less than 80 chars):
Change the css of the loading circle to use absolute positioning to prevent CLS
Description
The default
loading-progresssvg has a short height and positioned part way through the page. This is the initial<body>for the page. When the main app loads, the<body>needs repositioned to 0,0 and becomes the full length of the webpage.The change I've made makes the
loading-progresssvg positioned absolutely. This means the body tag's location will be 0,0 by default and not impacted by the defaultloading-progresssvg's position. When the app loads this means no cumulative layout shift happens.Cumulative Layout Shift is reduced to 0 for both mobile and desktop. Overall performance score rises to 69 (from 61).
On a live WASM website where I applied this change, the overall performance score rose from 31 to 40 on mobile and 60 to 68 on desktop.
Fixes #57212