Repository navigation
Keep metrics filter popover within the viewport - #21475
David Fowler (davidfowl) wants to merge 1 commit into
Conversation
The popover's anchor insets were declared with !important, which outranks position-try fallbacks, so flip-block never applied and the popup extended below the viewport when the filter button was near the bottom. Fixes #21239 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 21475Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 21475" |
Tests selector13 / 100 PR test projects · 2 PR jobs, from 2 changed files. Selected PR test projects (13 / 100)
Selected PR jobs (2)
How these were chosen — grouped by what changed
🔧 📦 affected project Job reasons
Selection computed for commit |
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review issues with the metrics filter popover positioning change.
No open issues 🎉
What changed in this PR
Fixes #21239 by allowing the dashboard’s metrics filter popover to open above its trigger when there is insufficient space below, keeping filter options accessible.
Changes:
- Replaces fixed anchor insets with
position-area, enabling the existingflip-blockfallback while overriding Fluent’s inline insets. - Adds Playwright regression tests for viewport containment, placement above or below the trigger, and right-edge alignment.
| File | Description |
|---|---|
| tests/Aspire.Dashboard.Playwright.Tests/Integration/Playwright/MetricsFilterPopoverTests.cs | Adds browser tests for constrained and roomy viewport placement. |
| src/Aspire.Dashboard/Components/Controls/Chart/ChartFilterPopover.razor.css | Updates positioning so the popover can flip above its trigger. |
Review effort: Balanced
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
Description
Fixes #21239.
When the metrics filter button is near the bottom of the viewport, the filter popup extends below the visible area. That cuts off the filter values, and the user can't reach them.
Root cause
ChartFilterPopover.razor.csspositioned the popover dialog with anchor insets declared!important(top: anchor(bottom) !important, etc.), and setposition-try-fallbacks: flip-block. In the CSS cascade, important author declarations outrank values from@position-tryfallbacks. So the browser could never apply the flipped position, and the popover always rendered below the trigger even with no room there.Measured on main at 1280x720 with the trigger scrolled to the bottom, the dialog spans y=686–841, past the 720px viewport.
Fix
Replace the important insets with
inset: auto !importantandposition-area: block-end span-inline-start:inset: auto !importantstill neutralizes the inline insets that Fluent's popover sets.position-areais not an inset property, soflip-blockcan flip it toblock-startwhen there's no room below.span-inline-startkeeps the existing alignment, with the popover's right edge aligned to the trigger's right edge.Other popovers in the dashboard use the same
!importantanchor-inset pattern (resource filters, URL column, user profile). I left them unchanged to keep this fix scoped; they could get the same treatment in a follow-up.Before / after
Tests
Added
MetricsFilterPopoverTests(Playwright; outerloop like the rest of the project). It seeds adotnet.gc.collectionsmetric with agc.heap.generationdimension and opens the filter popover:FilterPopover_TriggerNearViewportBottom_OpensAboveTriggerWithinViewport: asserts the dialog and its last option are inside the viewport, the dialog sits above the trigger, and the right edges are aligned.Filter popover should be within the viewport (0-720) but spans 686.453125-841.453125.FilterPopover_RoomBelowTrigger_OpensBelowTriggerAlignedToTriggerEnd: asserts the default placement is unchanged (below the trigger, right edges aligned). Passes before and after.Checklist
🤖 Posted by AspireAgent (AI Agent)