Files
radzen-blazor/Radzen.Blazor/RadzenFieldset.razor.cs

216 lines
7.4 KiB
C#
Raw Normal View History

using Microsoft.AspNetCore.Components;
Keyboard navigation and accessibility improvements added to all components (#1379) * Components keyboard navigation improved * Tree CheckBox TabIndex set to -1 * DataGrid and Pager keyboard navigation section added to first demo * DataFilter keyboard navigation info added to first page * Tree keyboard navigation info added to first page * Scheduler keyboard navigation info added to first page * DropDownDataGrid keyboard navigation info added to first page * DatePicker keyboard navigation info added to first page * FileInput keyboard navigation info added to first page * demo updated * SplitButton keyboard navigation info added to first page * Upload keyboard navigation info added * Chart keyboard navigation info added to first page * demo updated * focusTableRow() fixed * more focusTableRow() fixes * even more focusTableRow() fixes * Update Accessibility page content * Update anchors in navigation components demos and add keyboard navigation shortcuts * Update MainLayout * Update Scheduler focus styles * Update keyboard navigation wording * Appointments focus improved * Update and document HTMLEditor shortcuts * Appointment focus improvements for week view * Replace ripple's background transition with background-size * focus contentView on enter * focus View on enter * persist selected theme * YearPlannerView keyboard navigation improved * YearTimelineView keyboard navigation improved * months focus state fixed * days navigation fixed * code fixed * ScrollIntoView added * Update anchors in components demos * Update Scheduler focus styles * Update premium themes --------- Co-authored-by: yordanov <vasil@yordanov.info>
2024-02-19 10:31:27 +02:00
using Microsoft.AspNetCore.Components.Web;
V7 (#2144) * Remove Microsoft.CodeAnalysis. Add own C# expression parser. * Popup dialog animations (#2118) * Experiment with popup and dialog animations. * Move animations to a separate _animations.scss * Remove dialog closing animation. * Support side dialog positions. Prefix keyframes. * Use --rz-transition for animation function and duration * Reset site.css. * PanelMenu animations. * Display none is toggled a bit late. * RadzenPanel animations. * More animations. * Use transitions for panel menu. * Remove old code. * Accordion uses transitions. * Panel uses transitions. * Extract expand and collapse implementation in a separate component. * Set initial expand state earlier to prevent two renders. * Add open animation to notifications. * Handle onanimationend before toggling the animation classes. * Add menu animation. * Experiment with tree animation. * Add animations to fieldset. --------- Co-authored-by: yordanov <vasil@yordanov.info> * ExpressionSerializer and tests added (#2119) * Fix failing tests. * various components RequiresUnreferencedCode attribute added (#2120) * RequiresUnreferencedCode added to ExpressionSerializer * Update premium themes * RequiresUnreferencedCode added to ExpressionParser * FormComponentWithAutoComplete RequiresUnreferencedCode removed * Revert "FormComponentWithAutoComplete RequiresUnreferencedCode removed" This reverts commit ec900a4df863109d388c00b316f0d24092f087fc. * Revert "RequiresUnreferencedCode added to ExpressionParser" This reverts commit f93b3b159bab35258c6b07039952844de871fcb8. * Revert "RequiresUnreferencedCode added to ExpressionSerializer" This reverts commit 06fecec9a65416e969949eb49175857c530cb4a7. * Revert "various components RequiresUnreferencedCode attribute added (#2120)" This reverts commit 2ed1a6cac16f0867d89e0c9c2211486253445940. * Remove RadzenHtml. * ExpressionSerializer FormatValue updated to use InvariantCulture * Catch potential JS interop exceptions that could occur during disposing. * Revert "Remove RadzenHtml." This reverts commit 319085bf493fbba142610939c486d0f5de6c6a2e. * SelectBar made single tab stop * RadioButtonList and CheckBoxList made single tab stop * SelectBar accessibility improved * RadioButtonList accessibility improved * CheckBoxList accessibility improved * Update radio button focus styles * Update checkbox list focus styles * Update Checkbox Radio and SelectBar focus styles * SelectBar, CheckBoxList and RadioButtonList focus state improved * Check for Multiple added * Use non-rendering event handlers for transitionend. * Rename css class rz-selectbutton to rz-selectbar and improve focus states * Fix selectbar focus outline offset * Update premium themes * Selectbar item focus styles should not be visible if the item is disabled. * CheckBoxList and RadioButtonList item focus should be visible only on keyboard input * SelectBar, CheckBoxList and RadioButtonList focus logic improved * Update animations * RadzenText margin-block should be 0 if it is in RadzenStack. Resolves #2134 * RadzenText margin-block should be 0 if it is first level child in RadzenStack * CheckBoxList focused fixed * Add toggle state classes to panel menu icon. * Update accordion styles to reflect expander changes * Add animation styles to expand arrow in Menu and ProfileMenu * Use a instead of NavLink as it seems to cause performance issues. * Set @bind-Expanded. * Revert "Set @bind-Expanded." This reverts commit 994107367bdf09043950f8bbe701eb9edefec676. * Revert "Use a instead of NavLink as it seems to cause performance issues." This reverts commit 05d5bef8f421bbeb5828ba1e9c5af6793ea3d32a. * Reduce rendering of panel menu items. * Add panel menu component. * Use ChildContent to render the toggle icon of the panel menu item. * Sync panel menu item selection in the item itself. * Rename ExpandedInternal to expanded. * Move filtering to the panel menu component. * Remove the transitionend handler to avoid a second rendering pass. * Build the assets for the net9.0 framework. * Do not trigger render when Click is used. * Panel menu keyboard navigation renders only when needed. * Focus reworked to use AsNonRenderingEventHandler * Focus the first item. * Update Panel demo * Use a more robust algorithm for month view event rendering that handles overlapping of events across a week. * Use RadzenStack in RadioButtonList * Add parsing support for `&` and `|`. * Add parsing support for `^`, `>>` and `<<`. * Simplify expression parsing tests. * Use RadzenStack in RadioButtonList and CheckBoxList * Change defaults for AlignItems and JustifyContent in RadioButtonList and CheckBoxList * Update RadioButtonList and CheckBoxList demos * Add --rz-input-border-block-end css variables to improve Fluent theme styles * Removed AsNonRenderingEventHandler from RadioButtonList and HtmlEditor focus and blur * Removed AsNonRenderingEventHandler from CheckBoxList * Simplify RadzenTable rendering. * Optimize memory usage of the ClassList utility. * Refactor RadzenButton to use ClassList. * RadzenSelectBar and RadzenSplitButton use ClassList. * Refactor RadzenBadge and RadzenAlert to use ClassList. * Refactor RadzenCard and RadzenFormField to use ClassList. * Refactor RadzenCardGroup and progress components to use ClassList. * Refactor RadzenMenu to use ClassList. * Use ClassList in RadzenBody, RadzenLayout and editor rendering components. * RadzenDialog uses ClassList. * RadzenDataGrid uses ClassList. * RadzenPager uses ClassList. * RadzenColumn uses ClassList. * Fix RadzenSplitButtonItem focused state. --------- Co-authored-by: Atanas Korchev <akorchev@gmail.com> Co-authored-by: Atanas Korchev <454726+akorchev@users.noreply.github.com> Co-authored-by: yordanov <vasil@yordanov.info> Co-authored-by: Quentin H <67709967+quintushr@users.noreply.github.com>
2025-05-07 13:11:30 +03:00
using Radzen.Blazor.Rendering;
using System;
using System.Threading.Tasks;
namespace Radzen.Blazor
{
2021-10-07 11:35:29 +03:00
/// <summary>
2025-10-24 16:28:11 +03:00
/// A fieldset container component that groups related form fields with a legend/header and optional collapse functionality.
/// RadzenFieldset provides semantic form grouping with visual borders, useful for organizing complex forms into logical sections.
/// Fieldsets are HTML form elements that semantically group related inputs, improving form structure and accessibility.
/// Features visual and semantic grouping of related form fields, customizable header via Text or HeaderTemplate, optional expand/collapse to hide/show grouped fields,
/// optional icon in the legend, optional summary content shown when collapsed, and screen reader announcement of fieldset legends for grouped fields.
/// Use to organize forms into sections like "Personal Information", "Address", "Payment Details". When AllowCollapse is enabled, users can collapse sections they don't need to see.
/// </summary>
2021-10-15 11:50:31 +03:00
/// <example>
2025-10-24 16:28:11 +03:00
/// Basic fieldset grouping form fields:
2021-10-15 11:50:31 +03:00
/// <code>
2025-10-24 16:28:11 +03:00
/// &lt;RadzenFieldset Text="Personal Information"&gt;
/// &lt;RadzenStack Gap="1rem"&gt;
/// &lt;RadzenFormField Text="First Name"&gt;
/// &lt;RadzenTextBox @bind-Value=@model.FirstName /&gt;
/// &lt;/RadzenFormField&gt;
/// &lt;RadzenFormField Text="Last Name"&gt;
/// &lt;RadzenTextBox @bind-Value=@model.LastName /&gt;
/// &lt;/RadzenFormField&gt;
/// &lt;/RadzenStack&gt;
/// &lt;/RadzenFieldset&gt;
/// </code>
/// Collapsible fieldset:
/// <code>
/// &lt;RadzenFieldset Text="Advanced Options" Icon="settings" AllowCollapse="true"&gt;
/// Advanced configuration fields...
2021-10-15 11:50:31 +03:00
/// &lt;/RadzenFieldset&gt;
/// </code>
/// </example>
public partial class RadzenFieldset : RadzenComponent
{
2021-10-25 10:30:41 +03:00
/// <inheritdoc />
V7 (#2144) * Remove Microsoft.CodeAnalysis. Add own C# expression parser. * Popup dialog animations (#2118) * Experiment with popup and dialog animations. * Move animations to a separate _animations.scss * Remove dialog closing animation. * Support side dialog positions. Prefix keyframes. * Use --rz-transition for animation function and duration * Reset site.css. * PanelMenu animations. * Display none is toggled a bit late. * RadzenPanel animations. * More animations. * Use transitions for panel menu. * Remove old code. * Accordion uses transitions. * Panel uses transitions. * Extract expand and collapse implementation in a separate component. * Set initial expand state earlier to prevent two renders. * Add open animation to notifications. * Handle onanimationend before toggling the animation classes. * Add menu animation. * Experiment with tree animation. * Add animations to fieldset. --------- Co-authored-by: yordanov <vasil@yordanov.info> * ExpressionSerializer and tests added (#2119) * Fix failing tests. * various components RequiresUnreferencedCode attribute added (#2120) * RequiresUnreferencedCode added to ExpressionSerializer * Update premium themes * RequiresUnreferencedCode added to ExpressionParser * FormComponentWithAutoComplete RequiresUnreferencedCode removed * Revert "FormComponentWithAutoComplete RequiresUnreferencedCode removed" This reverts commit ec900a4df863109d388c00b316f0d24092f087fc. * Revert "RequiresUnreferencedCode added to ExpressionParser" This reverts commit f93b3b159bab35258c6b07039952844de871fcb8. * Revert "RequiresUnreferencedCode added to ExpressionSerializer" This reverts commit 06fecec9a65416e969949eb49175857c530cb4a7. * Revert "various components RequiresUnreferencedCode attribute added (#2120)" This reverts commit 2ed1a6cac16f0867d89e0c9c2211486253445940. * Remove RadzenHtml. * ExpressionSerializer FormatValue updated to use InvariantCulture * Catch potential JS interop exceptions that could occur during disposing. * Revert "Remove RadzenHtml." This reverts commit 319085bf493fbba142610939c486d0f5de6c6a2e. * SelectBar made single tab stop * RadioButtonList and CheckBoxList made single tab stop * SelectBar accessibility improved * RadioButtonList accessibility improved * CheckBoxList accessibility improved * Update radio button focus styles * Update checkbox list focus styles * Update Checkbox Radio and SelectBar focus styles * SelectBar, CheckBoxList and RadioButtonList focus state improved * Check for Multiple added * Use non-rendering event handlers for transitionend. * Rename css class rz-selectbutton to rz-selectbar and improve focus states * Fix selectbar focus outline offset * Update premium themes * Selectbar item focus styles should not be visible if the item is disabled. * CheckBoxList and RadioButtonList item focus should be visible only on keyboard input * SelectBar, CheckBoxList and RadioButtonList focus logic improved * Update animations * RadzenText margin-block should be 0 if it is in RadzenStack. Resolves #2134 * RadzenText margin-block should be 0 if it is first level child in RadzenStack * CheckBoxList focused fixed * Add toggle state classes to panel menu icon. * Update accordion styles to reflect expander changes * Add animation styles to expand arrow in Menu and ProfileMenu * Use a instead of NavLink as it seems to cause performance issues. * Set @bind-Expanded. * Revert "Set @bind-Expanded." This reverts commit 994107367bdf09043950f8bbe701eb9edefec676. * Revert "Use a instead of NavLink as it seems to cause performance issues." This reverts commit 05d5bef8f421bbeb5828ba1e9c5af6793ea3d32a. * Reduce rendering of panel menu items. * Add panel menu component. * Use ChildContent to render the toggle icon of the panel menu item. * Sync panel menu item selection in the item itself. * Rename ExpandedInternal to expanded. * Move filtering to the panel menu component. * Remove the transitionend handler to avoid a second rendering pass. * Build the assets for the net9.0 framework. * Do not trigger render when Click is used. * Panel menu keyboard navigation renders only when needed. * Focus reworked to use AsNonRenderingEventHandler * Focus the first item. * Update Panel demo * Use a more robust algorithm for month view event rendering that handles overlapping of events across a week. * Use RadzenStack in RadioButtonList * Add parsing support for `&` and `|`. * Add parsing support for `^`, `>>` and `<<`. * Simplify expression parsing tests. * Use RadzenStack in RadioButtonList and CheckBoxList * Change defaults for AlignItems and JustifyContent in RadioButtonList and CheckBoxList * Update RadioButtonList and CheckBoxList demos * Add --rz-input-border-block-end css variables to improve Fluent theme styles * Removed AsNonRenderingEventHandler from RadioButtonList and HtmlEditor focus and blur * Removed AsNonRenderingEventHandler from CheckBoxList * Simplify RadzenTable rendering. * Optimize memory usage of the ClassList utility. * Refactor RadzenButton to use ClassList. * RadzenSelectBar and RadzenSplitButton use ClassList. * Refactor RadzenBadge and RadzenAlert to use ClassList. * Refactor RadzenCard and RadzenFormField to use ClassList. * Refactor RadzenCardGroup and progress components to use ClassList. * Refactor RadzenMenu to use ClassList. * Use ClassList in RadzenBody, RadzenLayout and editor rendering components. * RadzenDialog uses ClassList. * RadzenDataGrid uses ClassList. * RadzenPager uses ClassList. * RadzenColumn uses ClassList. * Fix RadzenSplitButtonItem focused state. --------- Co-authored-by: Atanas Korchev <akorchev@gmail.com> Co-authored-by: Atanas Korchev <454726+akorchev@users.noreply.github.com> Co-authored-by: yordanov <vasil@yordanov.info> Co-authored-by: Quentin H <67709967+quintushr@users.noreply.github.com>
2025-05-07 13:11:30 +03:00
protected override string GetComponentCssClass() =>
ClassList.Create("rz-fieldset")
.Add("rz-fieldset-toggleable", AllowCollapse)
.ToString();
2021-10-07 11:35:29 +03:00
/// <summary>
2021-10-25 11:20:57 +03:00
/// Gets or sets a value indicating whether collapsing is allowed. Set to <c>false</c> by default.
2021-10-07 11:35:29 +03:00
/// </summary>
2021-10-25 11:20:57 +03:00
/// <value><c>true</c> if collapsing is allowed; otherwise, <c>false</c>.</value>
[Parameter]
public bool AllowCollapse { get; set; }
private bool collapsed;
2021-10-14 10:32:00 +03:00
2021-10-07 11:35:29 +03:00
/// <summary>
/// Gets or sets a value indicating whether this <see cref="RadzenFieldset"/> is collapsed.
/// </summary>
/// <value><c>true</c> if collapsed; otherwise, <c>false</c>.</value>
[Parameter]
public bool Collapsed { get; set; }
/// <summary>
/// Gets or sets the title attribute of the expand button.
/// </summary>
/// <value>The title attribute value of the expand button.</value>
[Parameter]
public string? ExpandTitle { get; set; }
/// <summary>
/// Gets or sets the title attribute of the collapse button.
/// </summary>
/// <value>The title attribute value of the collapse button.</value>
[Parameter]
public string? CollapseTitle { get; set; }
/// <summary>
/// Gets or sets the aria-label attribute of the expand button.
/// </summary>
/// <value>The aria-label attribute value of the expand button.</value>
[Parameter]
public string? ExpandAriaLabel { get; set; }
/// <summary>
/// Gets or sets the aria-label attribute of the collapse button.
/// </summary>
/// <value>The aria-label attribute value of the collapse button.</value>
[Parameter]
public string? CollapseAriaLabel { get; set; }
2021-10-07 11:35:29 +03:00
/// <summary>
/// Gets or sets the icon.
/// </summary>
/// <value>The icon.</value>
[Parameter]
public string? Icon { get; set; }
/// <summary>
/// Gets or sets the icon color.
/// </summary>
/// <value>The icon color.</value>
[Parameter]
public string? IconColor { get; set; }
2021-10-07 11:35:29 +03:00
/// <summary>
/// Gets or sets the text.
/// </summary>
/// <value>The text.</value>
[Parameter]
public string Text { get; set; } = "";
2021-10-07 11:35:29 +03:00
/// <summary>
/// Gets or sets the header template.
/// </summary>
/// <value>The header template.</value>
[Parameter]
public RenderFragment? HeaderTemplate { get; set; }
2021-10-07 11:35:29 +03:00
/// <summary>
2021-10-14 09:09:16 +03:00
/// Gets or sets the child content.
2021-10-07 11:35:29 +03:00
/// </summary>
2021-10-14 09:09:16 +03:00
/// <value>The child content.</value>
[Parameter]
public RenderFragment? ChildContent { get; set; }
2021-10-07 11:35:29 +03:00
/// <summary>
/// Gets or sets the summary template.
/// </summary>
/// <value>The summary template.</value>
[Parameter]
public RenderFragment? SummaryTemplate { get; set; } = null;
2021-10-07 11:35:29 +03:00
/// <summary>
2021-10-14 10:32:00 +03:00
/// Gets or sets the expand callback.
2021-10-07 11:35:29 +03:00
/// </summary>
2021-10-14 10:32:00 +03:00
/// <value>The expand callback.</value>
[Parameter]
public EventCallback Expand { get; set; }
2021-10-07 11:35:29 +03:00
/// <summary>
2021-10-14 10:32:00 +03:00
/// Gets or sets the collapse callback.
2021-10-07 11:35:29 +03:00
/// </summary>
2021-10-14 10:32:00 +03:00
/// <value>The collapse callback.</value>
[Parameter]
public EventCallback Collapse { get; set; }
V7 (#2144) * Remove Microsoft.CodeAnalysis. Add own C# expression parser. * Popup dialog animations (#2118) * Experiment with popup and dialog animations. * Move animations to a separate _animations.scss * Remove dialog closing animation. * Support side dialog positions. Prefix keyframes. * Use --rz-transition for animation function and duration * Reset site.css. * PanelMenu animations. * Display none is toggled a bit late. * RadzenPanel animations. * More animations. * Use transitions for panel menu. * Remove old code. * Accordion uses transitions. * Panel uses transitions. * Extract expand and collapse implementation in a separate component. * Set initial expand state earlier to prevent two renders. * Add open animation to notifications. * Handle onanimationend before toggling the animation classes. * Add menu animation. * Experiment with tree animation. * Add animations to fieldset. --------- Co-authored-by: yordanov <vasil@yordanov.info> * ExpressionSerializer and tests added (#2119) * Fix failing tests. * various components RequiresUnreferencedCode attribute added (#2120) * RequiresUnreferencedCode added to ExpressionSerializer * Update premium themes * RequiresUnreferencedCode added to ExpressionParser * FormComponentWithAutoComplete RequiresUnreferencedCode removed * Revert "FormComponentWithAutoComplete RequiresUnreferencedCode removed" This reverts commit ec900a4df863109d388c00b316f0d24092f087fc. * Revert "RequiresUnreferencedCode added to ExpressionParser" This reverts commit f93b3b159bab35258c6b07039952844de871fcb8. * Revert "RequiresUnreferencedCode added to ExpressionSerializer" This reverts commit 06fecec9a65416e969949eb49175857c530cb4a7. * Revert "various components RequiresUnreferencedCode attribute added (#2120)" This reverts commit 2ed1a6cac16f0867d89e0c9c2211486253445940. * Remove RadzenHtml. * ExpressionSerializer FormatValue updated to use InvariantCulture * Catch potential JS interop exceptions that could occur during disposing. * Revert "Remove RadzenHtml." This reverts commit 319085bf493fbba142610939c486d0f5de6c6a2e. * SelectBar made single tab stop * RadioButtonList and CheckBoxList made single tab stop * SelectBar accessibility improved * RadioButtonList accessibility improved * CheckBoxList accessibility improved * Update radio button focus styles * Update checkbox list focus styles * Update Checkbox Radio and SelectBar focus styles * SelectBar, CheckBoxList and RadioButtonList focus state improved * Check for Multiple added * Use non-rendering event handlers for transitionend. * Rename css class rz-selectbutton to rz-selectbar and improve focus states * Fix selectbar focus outline offset * Update premium themes * Selectbar item focus styles should not be visible if the item is disabled. * CheckBoxList and RadioButtonList item focus should be visible only on keyboard input * SelectBar, CheckBoxList and RadioButtonList focus logic improved * Update animations * RadzenText margin-block should be 0 if it is in RadzenStack. Resolves #2134 * RadzenText margin-block should be 0 if it is first level child in RadzenStack * CheckBoxList focused fixed * Add toggle state classes to panel menu icon. * Update accordion styles to reflect expander changes * Add animation styles to expand arrow in Menu and ProfileMenu * Use a instead of NavLink as it seems to cause performance issues. * Set @bind-Expanded. * Revert "Set @bind-Expanded." This reverts commit 994107367bdf09043950f8bbe701eb9edefec676. * Revert "Use a instead of NavLink as it seems to cause performance issues." This reverts commit 05d5bef8f421bbeb5828ba1e9c5af6793ea3d32a. * Reduce rendering of panel menu items. * Add panel menu component. * Use ChildContent to render the toggle icon of the panel menu item. * Sync panel menu item selection in the item itself. * Rename ExpandedInternal to expanded. * Move filtering to the panel menu component. * Remove the transitionend handler to avoid a second rendering pass. * Build the assets for the net9.0 framework. * Do not trigger render when Click is used. * Panel menu keyboard navigation renders only when needed. * Focus reworked to use AsNonRenderingEventHandler * Focus the first item. * Update Panel demo * Use a more robust algorithm for month view event rendering that handles overlapping of events across a week. * Use RadzenStack in RadioButtonList * Add parsing support for `&` and `|`. * Add parsing support for `^`, `>>` and `<<`. * Simplify expression parsing tests. * Use RadzenStack in RadioButtonList and CheckBoxList * Change defaults for AlignItems and JustifyContent in RadioButtonList and CheckBoxList * Update RadioButtonList and CheckBoxList demos * Add --rz-input-border-block-end css variables to improve Fluent theme styles * Removed AsNonRenderingEventHandler from RadioButtonList and HtmlEditor focus and blur * Removed AsNonRenderingEventHandler from CheckBoxList * Simplify RadzenTable rendering. * Optimize memory usage of the ClassList utility. * Refactor RadzenButton to use ClassList. * RadzenSelectBar and RadzenSplitButton use ClassList. * Refactor RadzenBadge and RadzenAlert to use ClassList. * Refactor RadzenCard and RadzenFormField to use ClassList. * Refactor RadzenCardGroup and progress components to use ClassList. * Refactor RadzenMenu to use ClassList. * Use ClassList in RadzenBody, RadzenLayout and editor rendering components. * RadzenDialog uses ClassList. * RadzenDataGrid uses ClassList. * RadzenPager uses ClassList. * RadzenColumn uses ClassList. * Fix RadzenSplitButtonItem focused state. --------- Co-authored-by: Atanas Korchev <akorchev@gmail.com> Co-authored-by: Atanas Korchev <454726+akorchev@users.noreply.github.com> Co-authored-by: yordanov <vasil@yordanov.info> Co-authored-by: Quentin H <67709967+quintushr@users.noreply.github.com>
2025-05-07 13:11:30 +03:00
async Task Toggle(EventArgs args)
{
collapsed = !collapsed;
if (collapsed)
{
await Collapse.InvokeAsync(args);
}
else
{
await Expand.InvokeAsync(args);
}
StateHasChanged();
}
2021-10-25 10:30:41 +03:00
/// <inheritdoc />
protected override void OnInitialized()
{
Keyboard navigation and accessibility improvements added to all components (#1379) * Components keyboard navigation improved * Tree CheckBox TabIndex set to -1 * DataGrid and Pager keyboard navigation section added to first demo * DataFilter keyboard navigation info added to first page * Tree keyboard navigation info added to first page * Scheduler keyboard navigation info added to first page * DropDownDataGrid keyboard navigation info added to first page * DatePicker keyboard navigation info added to first page * FileInput keyboard navigation info added to first page * demo updated * SplitButton keyboard navigation info added to first page * Upload keyboard navigation info added * Chart keyboard navigation info added to first page * demo updated * focusTableRow() fixed * more focusTableRow() fixes * even more focusTableRow() fixes * Update Accessibility page content * Update anchors in navigation components demos and add keyboard navigation shortcuts * Update MainLayout * Update Scheduler focus styles * Update keyboard navigation wording * Appointments focus improved * Update and document HTMLEditor shortcuts * Appointment focus improvements for week view * Replace ripple's background transition with background-size * focus contentView on enter * focus View on enter * persist selected theme * YearPlannerView keyboard navigation improved * YearTimelineView keyboard navigation improved * months focus state fixed * days navigation fixed * code fixed * ScrollIntoView added * Update anchors in components demos * Update Scheduler focus styles * Update premium themes --------- Co-authored-by: yordanov <vasil@yordanov.info>
2024-02-19 10:31:27 +02:00
base.OnInitialized();
collapsed = Collapsed;
}
private string TitleAttribute()
{
if (collapsed)
{
return string.IsNullOrWhiteSpace(ExpandTitle) ? "Expand" : ExpandTitle;
}
return string.IsNullOrWhiteSpace(CollapseTitle) ? "Collapse" : CollapseTitle;
}
private string AriaLabelAttribute()
{
if (collapsed)
{
return string.IsNullOrWhiteSpace(ExpandAriaLabel) ? "Expand" : ExpandAriaLabel;
}
return string.IsNullOrWhiteSpace(CollapseAriaLabel) ? "Collapse" : CollapseAriaLabel;
}
2021-10-25 10:30:41 +03:00
/// <inheritdoc />
public override async Task SetParametersAsync(ParameterView parameters)
{
if (parameters.DidParameterChange(nameof(Collapsed), Collapsed))
{
collapsed = parameters.GetValueOrDefault<bool>(nameof(Collapsed));
}
await base.SetParametersAsync(parameters);
}
bool preventKeyPress;
Keyboard navigation and accessibility improvements added to all components (#1379) * Components keyboard navigation improved * Tree CheckBox TabIndex set to -1 * DataGrid and Pager keyboard navigation section added to first demo * DataFilter keyboard navigation info added to first page * Tree keyboard navigation info added to first page * Scheduler keyboard navigation info added to first page * DropDownDataGrid keyboard navigation info added to first page * DatePicker keyboard navigation info added to first page * FileInput keyboard navigation info added to first page * demo updated * SplitButton keyboard navigation info added to first page * Upload keyboard navigation info added * Chart keyboard navigation info added to first page * demo updated * focusTableRow() fixed * more focusTableRow() fixes * even more focusTableRow() fixes * Update Accessibility page content * Update anchors in navigation components demos and add keyboard navigation shortcuts * Update MainLayout * Update Scheduler focus styles * Update keyboard navigation wording * Appointments focus improved * Update and document HTMLEditor shortcuts * Appointment focus improvements for week view * Replace ripple's background transition with background-size * focus contentView on enter * focus View on enter * persist selected theme * YearPlannerView keyboard navigation improved * YearTimelineView keyboard navigation improved * months focus state fixed * days navigation fixed * code fixed * ScrollIntoView added * Update anchors in components demos * Update Scheduler focus styles * Update premium themes --------- Co-authored-by: yordanov <vasil@yordanov.info>
2024-02-19 10:31:27 +02:00
async Task OnKeyPress(KeyboardEventArgs args, Task task)
{
var key = args.Code != null ? args.Code : args.Key;
if (key == "Space" || key == "Enter")
{
preventKeyPress = true;
await task;
}
else
{
preventKeyPress = false;
}
}
}
2021-10-25 10:06:11 +03:00
}