fix(share-popover): anchor popover to button via relative-positioned wrapper div

This commit is contained in:
daniel-c-harvey
2026-06-16 20:49:58 -04:00
parent daafae8af6
commit 81ea5909d2
2 changed files with 68 additions and 55 deletions
@@ -1,17 +1,22 @@
@namespace DeepDrftPublic.Client.Controls @namespace DeepDrftPublic.Client.Controls
<MudTooltip Text="Share"> @* Overlay is viewport-level; keep it outside the anchor wrapper so it doesn't
inherit relative stacking context and still covers the full page. *@
<MudOverlay Visible="@_open" OnClick="@Close" AutoClose="true" />
@* Wrap the trigger and popover in a relative-positioned container so MudPopover
anchors to the button rather than the nearest positioned ancestor in the page. *@
<div class="deepdrft-share-popover-anchor">
<MudTooltip Text="Share">
<MudIconButton Icon="@Icons.Material.Filled.Share" <MudIconButton Icon="@Icons.Material.Filled.Share"
Size="Size.Large" Size="Size.Large"
Color="Color.Secondary" Color="Color.Secondary"
Disabled="@(!RendererInfo.IsInteractive)" Disabled="@(!RendererInfo.IsInteractive)"
OnClick="@Toggle" OnClick="@Toggle"
aria-label="@(IsReleaseMode ? "Share this release" : "Share this track")" /> aria-label="@(IsReleaseMode ? "Share this release" : "Share this track")" />
</MudTooltip> </MudTooltip>
<MudOverlay Visible="@_open" OnClick="@Close" AutoClose="true" /> <MudPopover Open="@_open"
<MudPopover Open="@_open"
Fixed="false" Fixed="false"
AnchorOrigin="Origin.BottomRight" AnchorOrigin="Origin.BottomRight"
TransformOrigin="Origin.TopRight" TransformOrigin="Origin.TopRight"
@@ -63,4 +68,5 @@
} }
</MudStack> </MudStack>
</MudPopover> </MudPopover>
</div>
@@ -358,6 +358,13 @@ h2, h3, h4, h5, h6,
font-family: var(--deepdrft-font-mono) !important; font-family: var(--deepdrft-font-mono) !important;
} }
/* Relative-positioned wrapper that gives MudPopover a local anchor so it opens
adjacent to the share button rather than relative to the page body. */
.deepdrft-share-popover-anchor {
position: relative;
display: inline-block;
}
.deepdrft-share-popover-body { .deepdrft-share-popover-body {
padding: 0.75rem 1rem; padding: 0.75rem 1rem;
min-width: 280px; min-width: 280px;