Browse Source

Shorten the action menu and feature dialog comments

pull/25949/head
maliming 3 days ago
parent
commit
6a525aacd9
No known key found for this signature in database GPG Key ID: A646B9CB645ECEA4
  1. 11
      framework/src/Volo.Abp.MudBlazorUI/Components/AbpMudActionMenu.razor.cs
  2. 5
      framework/src/Volo.Abp.MudBlazorUI/Components/AbpMudActionMenuItem.razor.cs
  3. 5
      modules/feature-management/src/Volo.Abp.FeatureManagement.Blazor.MudBlazor/Components/FeatureManagementModal.razor
  4. 7
      modules/feature-management/src/Volo.Abp.FeatureManagement.Blazor.MudBlazor/Components/FeatureManagementModal.razor.cs

11
framework/src/Volo.Abp.MudBlazorUI/Components/AbpMudActionMenu.razor.cs

@ -9,8 +9,7 @@ using MudBlazor;
namespace Volo.Abp.MudBlazorUI.Components;
/// <summary>
/// A <see cref="MudMenu"/> for entity/row actions that open a dialog.
/// Use it together with <see cref="AbpMudActionMenuItem"/>.
/// A <see cref="MudMenu"/> for actions that open a dialog. Use it with <see cref="AbpMudActionMenuItem"/>.
/// </summary>
public partial class AbpMudActionMenu : ComponentBase
{
@ -35,8 +34,7 @@ public partial class AbpMudActionMenu : ComponentBase
public string? Label { get; set; }
/// <summary>
/// The accessible name of the activator. An activator without a <see cref="Label"/> falls back
/// to the localized "Actions" text.
/// The accessible name of an activator that has no <see cref="Label"/>. Defaults to "Actions".
/// </summary>
[Parameter]
public string? AriaLabel { get; set; }
@ -125,9 +123,8 @@ public partial class AbpMudActionMenu : ComponentBase
}
/// <summary>
/// Closes the whole menu hierarchy. <see cref="AbpMudActionMenuItem"/> calls this before running
/// its handler, because MudBlazor restores the focus to the activator while closing and that
/// would take the focus out of a dialog the handler opened.
/// Closes the whole menu hierarchy. MudBlazor restores the focus to the activator while closing,
/// so <see cref="AbpMudActionMenuItem"/> calls this before its handler opens a dialog.
/// </summary>
public virtual async Task CloseAsync()
{

5
framework/src/Volo.Abp.MudBlazorUI/Components/AbpMudActionMenuItem.razor.cs

@ -7,9 +7,8 @@ using MudBlazor;
namespace Volo.Abp.MudBlazorUI.Components;
/// <summary>
/// A menu item that closes its menu before running <see cref="OnClick"/>, so a dialog opened by
/// the handler keeps the focus. Works inside an <see cref="AbpMudActionMenu"/> and inside a plain
/// <see cref="MudMenu"/>.
/// A menu item that closes its menu before running <see cref="OnClick"/>, so a dialog opened by the
/// handler keeps the focus. Works in an <see cref="AbpMudActionMenu"/> and in a plain <see cref="MudMenu"/>.
/// </summary>
public partial class AbpMudActionMenuItem : ComponentBase
{

5
modules/feature-management/src/Volo.Abp.FeatureManagement.Blazor.MudBlazor/Components/FeatureManagementModal.razor

@ -20,7 +20,7 @@
PanelClass="pa-4">
@{
@* The features come from the definitions, so there is no known input to put
AutoFocus on. The first panel gets a container that takes the focus instead. *@
AutoFocus on. The first panel gets a container that takes the focus. *@
RenderFragment<FeatureGroupDto> renderGroup = group =>
@<MudStack Spacing="2">
<MudText Typo="Typo.h6">@group.DisplayName</MudText>
@ -74,8 +74,7 @@
@for (var groupIndex = 0; groupIndex < Groups.Count; groupIndex++)
{
var group = Groups[groupIndex];
@* MudTabs renders the panel content later, when the loop variable is already past
the last index. *@
@* MudTabs renders the panel content after the loop is over. *@
var isFirstGroup = groupIndex == 0;
<MudTabPanel Text="@group.DisplayName">
@if (isFirstGroup)

7
modules/feature-management/src/Volo.Abp.FeatureManagement.Blazor.MudBlazor/Components/FeatureManagementModal.razor.cs

@ -98,8 +98,7 @@ public partial class FeatureManagementModal
}
_isVisible = true;
// The previous reference points to an element that is gone, and it would be taken for a
// bound container on the next render.
// The previous reference points to an element that is gone by now.
_firstGroupContainer = default;
_shouldFocusFirstGroup = Groups.Any();
_focusRenderCount = 0;
@ -126,8 +125,8 @@ public partial class FeatureManagementModal
return;
}
// The dialog provider renders the content in a later batch, so the container is not bound yet
// on the render that makes the dialog visible. Rendering again brings this method back.
// The dialog provider renders the content in a later batch, so rendering again is what brings
// this method back once the container is bound.
if (_firstGroupContainer.Id.IsNullOrEmpty())
{
if (_focusRenderCount++ < MaxFocusRenderCount)

Loading…
Cancel
Save