Skip to content

Commit 3e22958

Browse files
[DialogHeader] Allow dialog title exclusion from tab index (#3137)
* Allow dialog title exclusion from tab index * Rework and include flexibility to the dismiss tooltip * Update comment based on official doc and fix allignment spaces * Fix build errors
1 parent 590de54 commit 3e22958

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed

examples/Demo/Shared/Microsoft.FluentUI.AspNetCore.Components.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3554,6 +3554,16 @@
35543554
If defined, this value will replace the one defined in the <see cref="T:Microsoft.FluentUI.AspNetCore.Components.DialogParameters"/>.
35553555
</summary>
35563556
</member>
3557+
<member name="P:Microsoft.FluentUI.AspNetCore.Components.FluentDialogHeader.ShowDismissTooltip">
3558+
<summary>
3559+
When true, shows the "Close" button tooltip in the header.
3560+
</summary>
3561+
</member>
3562+
<member name="P:Microsoft.FluentUI.AspNetCore.Components.FluentDialogHeader.TabIndex">
3563+
<summary>
3564+
Allows developers to make elements sequentially focusable and determine their relative ordering for navigation (usually with the Tab key).
3565+
</summary>
3566+
</member>
35573567
<member name="P:Microsoft.FluentUI.AspNetCore.Components.FluentDialogHeader.ChildContent">
35583568
<summary>
35593569
Gets or sets the content to be rendered inside the component.

src/Core/Components/Dialog/FluentDialogHeader.razor

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
Style="@StyleValue"
99
Class="@ClassValue"
1010
Id="@Id">
11-
<div style="width: 100%;" tabindex="0">
11+
<div style="width: 100%;" tabindex="@TabIndex">
1212
@if (@ChildContent == null && Dialog.Instance?.Parameters?.ShowTitle == true)
1313
{
1414
<FluentLabel Typo="Typography.PaneHeader">@Dialog.Instance?.Parameters?.Title</FluentLabel>
@@ -24,7 +24,11 @@
2424
<FluentButton Id="dialog_close" Appearance="Appearance.Stealth" OnClick="@(() => Dialog.CancelAsync())" aria-label="@Dialog.Instance?.Parameters?.DismissTitle">
2525
<FluentIcon Value="@(new CoreIcons.Regular.Size20.Dismiss())" Width="20px" Color="Color.Neutral" />
2626
</FluentButton>
27-
<FluentTooltip Anchor="dialog_close" Position="@TooltipPosition.Bottom">@Dialog.Instance?.Parameters?.DismissTitle</FluentTooltip>
27+
28+
if (ShowDismissTooltip == true)
29+
{
30+
<FluentTooltip Anchor="dialog_close" Position="@TooltipPosition.Bottom">@Dialog.Instance?.Parameters?.DismissTitle</FluentTooltip>
31+
}
2832
}
2933
</FluentStack>
3034
}

src/Core/Components/Dialog/FluentDialogHeader.razor.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,18 @@ public partial class FluentDialogHeader : FluentComponentBase
3434
[Parameter]
3535
public bool? ShowDismiss { get; set; }
3636

37+
/// <summary>
38+
/// When true, shows the "Close" button tooltip in the header.
39+
/// </summary>
40+
[Parameter]
41+
public bool? ShowDismissTooltip { get; set; } = true;
42+
43+
/// <summary>
44+
/// Allows developers to make elements sequentially focusable and determine their relative ordering for navigation (usually with the Tab key).
45+
/// </summary>
46+
[Parameter]
47+
public int? TabIndex { get; set; } = 0;
48+
3749
/// <summary>
3850
/// Gets or sets the content to be rendered inside the component.
3951
/// </summary>

0 commit comments

Comments
 (0)