Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the Apache 2.0 License
// See the LICENSE file in the project root for more information.
// Maintainer: Argo Zhang(argo@live.ca) Website: https://www.blazor.zone
Expand Down
2 changes: 1 addition & 1 deletion src/BootstrapBlazor/BootstrapBlazor.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<Version>10.5.1-beta01</Version>
<Version>10.5.1-beta04</Version>
</PropertyGroup>
Comment on lines 3 to 5
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR title/linked issue indicate a documentation-only change, but this PR also introduces behavioral changes (new AppendToBody option, JS logic changes) and bumps the package version. Please align the PR metadata/title/description with the actual scope, or split version bump/behavior changes into a separate PR.

Copilot uses AI. Check for mistakes.

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/BootstrapBlazor/Components/Mask/Mask.razor
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@namespace BootstrapBlazor.Components
@namespace BootstrapBlazor.Components
@inherits BootstrapModuleComponentBase
@attribute [BootstrapModuleAutoLoader(AutoInvokeInit = false, AutoInvokeDispose = false)]

Expand Down
19 changes: 16 additions & 3 deletions src/BootstrapBlazor/Components/Mask/Mask.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ protected override async Task OnAfterRenderAsync(bool firstRender)
{
Show = _options != null,
_options?.ContainerId,
_options?.Selector
_options?.Selector,
_options?.AppendToBody
});
}
}
Expand All @@ -59,8 +60,20 @@ private Task Show(MaskOption? option)
return Task.CompletedTask;
}

private Task CloseAsync()
private Task CloseAsync() => Show(null);

/// <summary>
/// <inheritdoc/>
/// </summary>
/// <param name="disposing"></param>
/// <returns></returns>
protected override async ValueTask DisposeAsync(bool disposing)
{
return Show(null);
await base.DisposeAsync(disposing);

if (disposing)
{
MaskService.UnRegister(this);
}
}
}
6 changes: 3 additions & 3 deletions src/BootstrapBlazor/Components/Mask/Mask.razor.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export function update(id, options) {
export function update(id, options) {
const mask = document.getElementById(id);
if (mask) {
const { show } = options;
const { show, appendToBody } = options;
const el = document.querySelector(`[data-bb-mask="${id}"]`);
const container = getContainerBySelector(options);
if (container) {
Expand All @@ -14,7 +14,7 @@
container.appendChild(el);
}
}
else {
else if (appendToBody === true) {
document.body.appendChild(el);
}
Comment on lines +14 to 16
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When appendToBody is false and no container is resolved, the mask element stays inside the <template> and therefore won’t be rendered/visible even when show is true. Consider appending to a sensible default (e.g., mask.parentElement) or enforcing that containerId/selector must be set when appendToBody is false (with a clear error).

Copilot uses AI. Check for mistakes.

Expand Down
7 changes: 7 additions & 0 deletions src/BootstrapBlazor/Components/Mask/MaskOption.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,11 @@ public class MaskOption
/// <para lang="en">Gets or sets Mask Parent Container Selector. Default null</para>
/// </summary>
public string? Selector { get; set; }

/// <summary>
/// <para lang="zh">获得/设置 是否将遮罩追加到 body 元素 默认 true</para>
/// <para lang="en">Gets or sets whether to append the mask to the body element. Default true</para>
/// <para>v<vesion>10.5.1</vesion></para>
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

XML doc tag appears misspelled: <vesion> isn’t used elsewhere in the codebase (convention is <version>). This will likely break doc tooling / consistency; please change to <version>.

Suggested change
/// <para>v<vesion>10.5.1</vesion></para>
/// <para>v<version>10.5.1</version></para>

Copilot uses AI. Check for mistakes.
/// </summary>
public bool AppendToBody { get; set; } = true;
Comment on lines +51 to +55
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (typo): Fix the <vesion> tag typo and redundant leading v in the XML doc.

The vesion tag appears to be a typo, and the leading v makes the XML odd. Use a proper tag (e.g. <version>10.5.1</version>) that your tooling recognizes so XML parsers and doc generators can handle it correctly.

Suggested change
/// <para lang="zh">获得/设置 是否将遮罩追加到 body 元素 默认 true</para>
/// <para lang="en">Gets or sets whether to append the mask to the body element. Default true</para>
/// <para>v<vesion>10.5.1</vesion></para>
/// </summary>
public bool AppendToBody { get; set; } = true;
/// <para lang="zh">获得/设置 是否将遮罩追加到 body 元素 默认 true</para>
/// <para lang="en">Gets or sets whether to append the mask to the body element. Default true</para>
/// <para><version>10.5.1</version></para>
/// </summary>
public bool AppendToBody { get; set; } = true;

}
Loading