Repository navigation
Improve dashboard scroll-to-bottom behavior and lifecycle - #20139
James Newton-King (JamesNK) merged 8 commits into
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 20139Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 20139" |
There was a problem hiding this comment.
🟡 Changes recommended
Browser coverage does not exercise user-input cancellation or ancestor-scroll layout updates.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Improves dashboard scroll-to-bottom behavior, lifecycle cleanup, positioning, and modal interaction.
Changes:
- Extracts scrolling logic into a custom-element module.
- Adds smooth-scroll correction, delayed visibility, and reduced-motion handling.
- Expands component, browser, and compression coverage.
File summaries
| File | Description |
|---|---|
tests/Aspire.Dashboard.Tests/Integration/ResponseCompressionTests.cs |
Covers compression of the new module. |
tests/Aspire.Dashboard.Tests/Integration/Playwright/DashboardInteractionsTests.cs |
Revises browser interaction and lifecycle scenarios. |
tests/Aspire.Dashboard.Components.Tests/Pages/TracesTests.cs |
Verifies the traces marker. |
tests/Aspire.Dashboard.Components.Tests/Pages/StructuredLogsTests.cs |
Verifies the structured-logs marker. |
tests/Aspire.Dashboard.Components.Tests/Controls/LogViewerTests.cs |
Verifies the console marker. |
src/Aspire.Dashboard/wwwroot/js/app.js |
Removes the previous implementation. |
src/Aspire.Dashboard/wwwroot/js/app-scroll.js |
Implements the custom element and scrolling lifecycle. |
src/Aspire.Dashboard/wwwroot/css/layout.css |
Updates ownership documentation and stacking order. |
src/Aspire.Dashboard/Components/Pages/Traces.razor |
Registers the traces scroll container. |
src/Aspire.Dashboard/Components/Pages/StructuredLogs.razor |
Registers the structured-logs container. |
src/Aspire.Dashboard/Components/Controls/LogViewer.razor |
Registers the console-log container. |
src/Aspire.Dashboard/Components/App.razor |
Loads the new module. |
Review details
- Files reviewed: 13/13 changed files
- Comments generated: 2
- Review effort level: Balanced
There was a problem hiding this comment.
🔵 Needs a closer look
The user-input cancellation paths added for pending smooth-scroll correction lack browser regression coverage.
Review details
Suppressed comments (1)
src/Aspire.Dashboard/wwwroot/js/app-scroll.js:151
- The new wheel, pointer, and keyboard handlers are not exercised by the Playwright coverage: no test sends any of these inputs while a smooth scroll has a pending
scrollendcorrection. This leaves the user-interruption contract unprotected; add a browser test that grows the content during smooth scrolling, interrupts it through each input path, and verifies the final correction is canceled.
const cancelForUserInput = function () {
cancelPendingScrollToBottom(entry);
scheduleUpdate();
};
container.addEventListener("wheel", cancelForUserInput, { passive: true, signal: eventController.signal });
container.addEventListener("pointerdown", cancelForUserInput, { passive: true, signal: eventController.signal });
container.addEventListener("keydown", cancelForUserInput, { signal: eventController.signal });
- Files reviewed: 13/13 changed files
- Comments generated: 0 new
- Review effort level: Balanced
There was a problem hiding this comment.
🟡 Changes recommended
The floating control ignores clipping ancestors, and user-input cancellation lacks regression coverage.
Get a fresh assessment by requesting another Copilot review.
Review details
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
tests/Aspire.Dashboard.Tests/Integration/Playwright/DashboardInteractionsTests.cs:112
- This smooth-scroll test verifies that the final correction runs, but no test exercises the new wheel, pointer, or keyboard cancellation paths. Removing any of the
cancelForUserInputregistrations would still leave the suite green. Add coverage that grows content during the animation, dispatches each input type, and verifies the laterscrollenddoes not jump to the new bottom.
- Files reviewed: 13/13 changed files
- Comments generated: 1
- Review effort level: Balanced
There was a problem hiding this comment.
🔵 Needs a closer look
Content-only growth can leave the button inactive, and keyboard input may not cancel correction after activation.
Review details
Suppressed comments (2)
Previously missed (2) — in code that hasn't changed since the last review.
src/Aspire.Dashboard/wwwroot/js/app-scroll.js:151
- Keyboard cancellation is attached only to the container, but activating the body-level button moves focus off that container; once the click handler hides the button, subsequent key events target the document/body and never reach this listener. A keyboard attempt to interrupt the smooth scroll therefore leaves the
scrollendcorrection armed and can still jump to the bottom. Listen for keydown at the window level (or explicitly preserve/restore container focus) so the documented cancellation works after activation.
src/Aspire.Dashboard/wwwroot/js/app-scroll.js:162 - The observer watches only the scroll container's own box, so streaming rows can increase
scrollHeightwithout scheduling a visibility update. For example, if overflow is initially 100px, the user scrolls up, and later rows push it past the 240px threshold, the root remains inactive until another scroll or resize occurs. Observe the scroll-content size (including replacement content) or otherwise signalscheduleUpdate()when content grows, and cover threshold crossing while the container remains stationary.
- Files reviewed: 13/13 changed files
- Comments generated: 0 new
- Review effort level: Balanced
There was a problem hiding this comment.
🔵 Needs a closer look
Content-height changes can leave button eligibility stale, and input cancellation lacks regression coverage.
Review details
Suppressed comments (2)
Previously missed (1) — in code that hasn't changed since the last review.
src/Aspire.Dashboard/wwwroot/js/app-scroll.js:164
- Observing only the scroll container misses changes to its
scrollHeightwhen its fixed content box does not resize. For example, after a user scrolls to the top, filtering a 2000px grid down to 500px can leave the scrollbar present while crossing the 240px threshold; neitherscrollnor this observer fires, so the body-level button remains visible with stale eligibility. Observe the scrolling content (or have the existing content-resize path notify this module) so content growth and shrinkage reevaluate visibility.
src/Aspire.Dashboard/wwwroot/js/app-scroll.js:153
- These listeners implement the promised cancellation of the final smooth-scroll correction, but no browser test dispatches
wheel,pointerdown, orkeydown; the current smooth-scroll test still passes if all three listeners are removed. Add parameterized Playwright coverage that grows content during smooth scrolling, sends each input beforescrollend, and verifies the final correction does not jump to the new bottom.
container.addEventListener("wheel", cancelForUserInput, { passive: true, signal: eventController.signal });
container.addEventListener("pointerdown", cancelForUserInput, { passive: true, signal: eventController.signal });
container.addEventListener("keydown", cancelForUserInput, { signal: eventController.signal });
- Files reviewed: 13/13 changed files
- Comments generated: 0 new
- Review effort level: Balanced
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
There was a problem hiding this comment.
🟢 Approval recommended
The implementation is internally consistent and includes focused component, browser, accessibility, lifecycle, and static-asset coverage.
Review details
- Files reviewed: 13/13 changed files
- Comments generated: 0 new
- Review effort level: Balanced
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
720d66e
into
microsoft:main
Description
Improve the dashboard's scroll-to-bottom button for console logs, structured logs, and traces. The button avoids flashing during initial scroll restoration, disappears immediately when clicked, and reaches the latest content even when rows arrive during native smooth scrolling.
User-facing behavior
scrollendfires. Respect reduced motion with immediate scrolling, and cancel the pending correction on wheel, pointer, or keyboard input.Implementation
app.jsinto theapp-scroll.jsmodule.<aspire-scroll-to-bottom>element inside each owning scroll container.connectedCallbackregisters the parent anddisconnectedCallbackcleans up the floating button, listeners, observer, timers, and pending animation frame. Connecting a new owner replaces the active registration; a late disconnect from the old owner cannot remove the replacement.<body>without modifying Blazor-owned container content.data-scroll-to-bottom-labelfrom<body>onto each web component. The owning Razor views supply the localized label, and the component uses it for the floating button's accessible name and tooltip, preserving the English fallback. Remove the unused body localizer and retain the existing focus behavior.Tests and validation
BuildProjectReferences=falsebecause a running dashboard/debugger locked its build outputs. The .NET outerloop suite was not run locally.Checklist
<remarks />and<code />elements on your triple slash comments?