MASA.Blazor icon indicating copy to clipboard operation
MASA.Blazor copied to clipboard

[Bug Report]: 页面滚动后,Dialog 中的 Menu 弹出位置不正确

Open LittleFish-233 opened this issue 1 year ago • 0 comments

Masa.Blazor version

1.4.2

Describe the bug

当页面滚动后,点击打开 Dialog 弹窗后,再次点击弹窗中的按钮触发 Menu 弹出,Menu弹出的位置不正确

image

Expected Behavior

Menu 应该显示在按钮正下方

image

Steps To Reproduce

通过模板创建项目,复制以下代码到 Index.razor

<div class="text-center">
    <MButton Color="red lighten-2"
             Dark OnClick="()=>dialog=true">
        Click Me
    </MButton>
</div>

<MDialog @bind-Value="dialog"
         Width="500">
    <ChildContent>
        <MCard>
            <MCardText>
                <MMenu OffsetY>
                    <ActivatorContent>
                        <MButton Color="primary" @attributes="@context.Attrs">DROPDOWN</MButton>
                    </ActivatorContent>
                    <ChildContent>
                        <MList>
                            @foreach (var item in items)
                            {
                                <MListItem>
                                    <MListItemContent>
                                        <MListItemTitle>
                                            @item
                                        </MListItemTitle>
                                    </MListItemContent>
                                </MListItem>
                            }
                        </MList>
                    </ChildContent>
                </MMenu>
            </MCardText>
        </MCard>
    </ChildContent>
</MDialog>

<div class="text-center" style="margin-top:1200px">
    <MButton Color="red lighten-2"
             Dark OnClick="()=>dialog=true">
        Click Me
    </MButton>
</div>

@code {

    bool dialog;

    string[] items =
    {
        "Click Me",
        "Click Me",
        "Click Me",
        "Click Me 2"
    };
}

运行后,滚动页面到底部,点击按钮,再次点击弹窗中的按钮,可以观察到菜单的弹出位置不正确

Reproduction code

No response

.NET version

8.0

What browsers are you seeing the problem on?

No response

Additional context

其他依赖 Menu 的组件也显示不正确,例如:Selecte,DatePicker.......

尝试将 MenuAllowOverflow 的值修改为 true 后正常。不确定是不是设计如此。

LittleFish-233 avatar May 05 '24 04:05 LittleFish-233