Skip to content

Commit

Permalink
various accessibility errors fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
enchev committed Dec 6, 2023
1 parent e60d681 commit 0c34028
Show file tree
Hide file tree
Showing 42 changed files with 81 additions and 56 deletions.
1 change: 1 addition & 0 deletions Radzen.Blazor/RadzenAutoComplete.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public partial class RadzenAutoComplete : DataBoundFormComponent<string>
/// Specifies additional custom attributes that will be rendered by the input.
/// </summary>
/// <value>The attributes.</value>
[Parameter]
public IReadOnlyDictionary<string, object> InputAttributes { get; set; }

/// <summary>
Expand Down
7 changes: 3 additions & 4 deletions Radzen.Blazor/RadzenDataGrid.razor
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@
</div>
</div>

<RadzenDatePicker TValue="@object" AllowInput=@(AllowFilterDateInput)
<RadzenDatePicker TValue="@object" AllowInput=@(AllowFilterDateInput) InputAttributes="@(new Dictionary<string,object>(){ { "aria-label", "filter value" }})"
ShowTime="@column.ShowTimeForDateTimeFilter()" ShowTimeOkButton="false" Inline="true" DateFormat="@getFilterDateFormat(column)"
Value="@column.GetFilterValue()" Change="@(args => { column.SetFilterValue(args.Value); SaveSettings(); })" />

Expand All @@ -278,7 +278,7 @@
else
{
<RadzenDataGridFilterMenu Grid="@this" Column="@column" />
<RadzenDatePicker Disabled=@column.CanSetFilterValue() TValue="@object" Style="width:100%" AllowInput=@(AllowFilterDateInput) AllowClear="true"
<RadzenDatePicker Disabled=@column.CanSetFilterValue() TValue="@object" Style="width:100%" AllowInput=@(AllowFilterDateInput) AllowClear="true" InputAttributes="@(new Dictionary<string,object>(){ { "aria-label", "filter value" }})"
ShowTime="false" ShowTimeOkButton="false" DateFormat="@getFilterDateFormat(column)"
Value="@column.GetFilterValue()" Change="@(args => { if(!args.HasValue) { InvokeAsync(() => ClearFilter(column, true)); } else {column.SetFilterValue(args.Value); InvokeAsync(() => ApplyFilter(column, true));} })" />
}
Expand Down Expand Up @@ -310,8 +310,7 @@
{
<RadzenDataGridFilterMenu Grid="@this" Column="@column" />
}
<label class="rz-helper-hidden-accessible" style="position:absolute !important" id="@($"{getFilterInputId(column)}-sfl")" for="@($"{getFilterInputId(column)}")">filter</label>
<input aria-labelledby="@($"{getFilterInputId(column)}-sfl")" disabled=@column.CanSetFilterValue() id="@(getFilterInputId(column))" @onchange="@((args) => OnFilter(args, column))" @onkeydown="@((args) => OnFilterKeyPress(args, column))" value="@column.GetFilterValue()" type="text" placeholder="@column.GetFilterPlaceholder()" class="rz-textbox" style="width: 100%;" />
<input aria-label="filter" disabled=@column.CanSetFilterValue() id="@(getFilterInputId(column))" @onchange="@((args) => OnFilter(args, column))" @onkeydown="@((args) => OnFilterKeyPress(args, column))" value="@column.GetFilterValue()" type="text" placeholder="@column.GetFilterPlaceholder()" class="rz-textbox" style="width: 100%;" />
@if (column.GetFilterValue() != null && filters.Any(d => d.Property == column.GetFilterProperty()))
{
<i @onclick="@((args) => ClearFilter(column))" class="rzi rz-cell-filter-clear" style="position:absolute;right:10px;">close</i>
Expand Down
10 changes: 4 additions & 6 deletions Radzen.Blazor/RadzenDataGridHeaderCell.razor
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
}
else if (PropertyAccess.IsDate(Column.FilterPropertyType))
{
<RadzenDatePicker TValue="@object" ShowTime="@Column.ShowTimeForDateTimeFilter()" ShowTimeOkButton="true" DateFormat="@Grid.getFilterDateFormat(Column)"
<RadzenDatePicker InputAttributes="@(new Dictionary<string,object>(){ { "aria-label", "filter value" }})" TValue="@object" ShowTime="@Column.ShowTimeForDateTimeFilter()" ShowTimeOkButton="true" DateFormat="@Grid.getFilterDateFormat(Column)"
Value="@Column.GetFilterValue()" Change="@(args => Column.SetFilterValue(args.Value))" AllowInput=@(Grid.AllowFilterDateInput) />

}
Expand All @@ -97,8 +97,7 @@
}
else
{
<label class="rz-helper-hidden-accessible" style="position:absolute !important" id="@($"{getColumnPopupID()}-sfl")" for="@($"{getColumnPopupID()}-sf")">filter</label>
<RadzenTextBox id="@($"{getColumnPopupID()}-sf")" aria-labelledby="@($"{getColumnPopupID()}-sfl")" Value="@($"{Column.GetFilterValue()}")" Change="@(args => Column.SetFilterValue(args))" />
<RadzenTextBox id="@($"{getColumnPopupID()}-sf")" aria-label="filter" Value="@($"{Column.GetFilterValue()}")" Change="@(args => Column.SetFilterValue(args))" />
}

<RadzenDropDown @onclick:preventDefault="true" TextProperty="Text" ValueProperty="Value" Style="width: 90px"
Expand All @@ -121,7 +120,7 @@
}
else if (PropertyAccess.IsDate(Column.FilterPropertyType))
{
<RadzenDatePicker TValue="@object"
<RadzenDatePicker TValue="@object" InputAttributes="@(new Dictionary<string,object>(){ { "aria-label", "second filter value" }})"
ShowTime="@Column.ShowTimeForDateTimeFilter()" ShowTimeOkButton="true" DateFormat="@Grid.getFilterDateFormat(Column)"
Value="@Column.GetSecondFilterValue()" Change="@(args => Column.SetFilterValue(args.Value, false))" AllowInput=@(Grid.AllowFilterDateInput) />

Expand All @@ -132,8 +131,7 @@
}
else
{
<label class="rz-helper-hidden-accessible" style="position:absolute !important" id="@($"{getColumnPopupID()}-sfl2")" for="@($"{getColumnPopupID()}-sf2")">filter</label>
<RadzenTextBox id="@($"{getColumnPopupID()}-sf2")" aria-labelledby="@($"{getColumnPopupID()}-sfl2")" Value="@($"{Column.GetSecondFilterValue()}")" Change="@(args => Column.SetFilterValue(args, false))" />
<RadzenTextBox id="@($"{getColumnPopupID()}-sf2")" aria-label="filter" Value="@($"{Column.GetSecondFilterValue()}")" Change="@(args => Column.SetFilterValue(args, false))" />
}
</form>
}
Expand Down
9 changes: 3 additions & 6 deletions Radzen.Blazor/RadzenDatePicker.razor
Original file line number Diff line number Diff line change
Expand Up @@ -103,23 +103,20 @@
@if (ShowTime)
{
<div class="rz-timepicker" @onmousedown:stopPropagation>
<label class="rz-helper-hidden-accessible" style="position:absolute !important" id="@($"{UniqueID}-hl")" for="@($"{UniqueID}-h")">hour</label>
<RadzenNumeric TValue="int" Disabled="@Disabled" Value="@(HourFormat == "12" ? ((CurrentDate.Hour + 11) % 12) + 1 : CurrentDate.Hour)"
<RadzenNumeric InputAttributes="@(new Dictionary<string,object>(){ { "aria-label", "hour" }})" TValue="int" Disabled="@Disabled" Value="@(HourFormat == "12" ? ((CurrentDate.Hour + 11) % 12) + 1 : CurrentDate.Hour)"
Min="@(HourFormat == "12" ? 1 : -1)" Max="@(HourFormat == "12" ? 12 : 24)" TValue="double" Step="@HoursStep"
Change="@UpdateHour" class="rz-hour-picker" @oninput=@OnUpdateHourInput Format="@(PadHours ? "00" : "")" Name="@($"{UniqueID}-h")" />
<div class="rz-separator">
<span>:</span>
</div>
<label class="rz-helper-hidden-accessible" style="position:absolute !important" id="@($"{UniqueID}-ml")" for="@($"{UniqueID}-m")">minutes</label>
<RadzenNumeric TValue="int" Disabled="@Disabled" Value="CurrentDate.Minute" TValue="double" Step="@MinutesStep" Min="0" Max="59"
<RadzenNumeric InputAttributes="@(new Dictionary<string,object>(){ { "aria-label", "minutes" }})" TValue="int" Disabled="@Disabled" Value="CurrentDate.Minute" TValue="double" Step="@MinutesStep" Min="0" Max="59"
Change="@UpdateMinutes" class="rz-minute-picker" @oninput=@OnUpdateHourMinutes Format="@(PadMinutes ? "00" : "")" Name="@($"{UniqueID}-m")"/>
@if (ShowSeconds)
{
<div class="rz-separator">
<span>:</span>
</div>
<label class="rz-helper-hidden-accessible" style="position:absolute !important" id="@($"{UniqueID}-sl")" for="@($"{UniqueID}-s")">seconds</label>
<RadzenNumeric TValue="int" Disabled="@Disabled" Value="CurrentDate.Second" TValue="double" Step="@SecondsStep" Min="0" Max="59"
<RadzenNumeric InputAttributes="@(new Dictionary<string,object>(){ { "aria-label", "seconds" }})" TValue="int" Disabled="@Disabled" Value="CurrentDate.Second" TValue="double" Step="@SecondsStep" Min="0" Max="59"
Change="@UpdateSeconds" class="rz-second-picker" @oninput=@OnUpdateHourSeconds Format="@(PadSeconds ? "00" : "")" Name="@($"{UniqueID}-s")"/>
}
@if (HourFormat == "12")
Expand Down
1 change: 1 addition & 0 deletions Radzen.Blazor/RadzenDatePicker.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public partial class RadzenDatePicker<TValue> : RadzenComponent, IRadzenFormComp
/// Specifies additional custom attributes that will be rendered by the input.
/// </summary>
/// <value>The attributes.</value>
[Parameter]
public IReadOnlyDictionary<string, object> InputAttributes { get; set; }

RadzenDropDown<int> monthDropDown;
Expand Down
9 changes: 3 additions & 6 deletions Radzen.Blazor/RadzenDropDown.razor
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,7 @@
@if (AllowFiltering && !Multiple)
{
<div class="rz-dropdown-filter-container">
<label class="rz-helper-hidden-accessible" style="position:absolute !important" for="@SearchID">search</label>
<input id="@SearchID" @ref="@search" tabindex="@(Disabled ? "-1" : $"{TabIndex}")" placeholder="@FilterPlaceholder" class="rz-dropdown-filter rz-inputtext " autocomplete="off" type="text"
<input aria-label="search" id="@SearchID" @ref="@search" tabindex="@(Disabled ? "-1" : $"{TabIndex}")" placeholder="@FilterPlaceholder" class="rz-dropdown-filter rz-inputtext " autocomplete="off" type="text"
@onchange="@((ChangeEventArgs args) => OnFilter(args))" @onkeydown="@((args) => OnFilterKeyPress(args))" value="@searchText"
@oninput=@(args => { searchText = $"{args.Value}"; SearchTextChanged.InvokeAsync(searchText);}) />
<span class="rz-dropdown-filter-icon rzi rzi-search"></span>
Expand All @@ -117,8 +116,7 @@
{
<div class="rz-chkbox" title="@(!AllowFiltering ? "" : SelectAllText)" @onclick="@SelectAll">
<div class="rz-helper-hidden-accessible">
<label class="rz-helper-hidden-accessible" style="position:absolute !important" for="@($"{(Name ?? UniqueID + "sa")}")">selectall</label>
<input readonly="readonly" type="checkbox" id="@($"{(Name ?? UniqueID + "sa")}")">
<input readonly="readonly" type="checkbox" id="@($"{(Name ?? UniqueID + "sa")}")" aria-label="search">
</div>
<div class="@(IsAllSelected() ? "rz-chkbox-box rz-state-active" : "rz-chkbox-box")">
<span class="@(IsAllSelected() ? "rz-chkbox-icon rzi rzi-check" : "rz-chkbox-icon")"></span>
Expand All @@ -132,9 +130,8 @@
@if (AllowFiltering)
{
<div class="rz-multiselect-filter-container">
<label class="rz-helper-hidden-accessible" style="position:absolute !important" for="@SearchID">search</label>
<input id="@SearchID" tabindex="@(Disabled ? "-1" : $"{TabIndex}")" class="rz-inputtext" role="textbox" type="text"
onclick="Radzen.preventDefaultAndStopPropagation(event)"
onclick="Radzen.preventDefaultAndStopPropagation(event)" aria-label="search"
@ref="@search" @oninput=@(args => { searchText = $"{args.Value}"; SearchTextChanged.InvokeAsync(searchText);})
@onchange="@((args) => OnFilter(args))" @onkeydown="@((args) => OnFilterKeyPress(args))" value="@searchText" />
<span class="rz-multiselect-filter-icon rzi rzi-search"></span>
Expand Down
1 change: 1 addition & 0 deletions Radzen.Blazor/RadzenDropDown.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public partial class RadzenDropDown<TValue> : DropDownBase<TValue>
/// Specifies additional custom attributes that will be rendered by the input.
/// </summary>
/// <value>The attributes.</value>
[Parameter]
public IReadOnlyDictionary<string, object> InputAttributes { get; set; }

/// <summary>
Expand Down
3 changes: 1 addition & 2 deletions Radzen.Blazor/RadzenDropDownDataGrid.razor
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,7 @@
@if (AllowFiltering)
{
<div class="rz-lookup-search">
<label class="rz-helper-hidden-accessible" style="position:absolute !important" for="@SearchID">search</label>
<input class="rz-lookup-search-input" id="@SearchID" @ref="@search" tabindex="-1" placeholder="@SearchTextPlaceholder"
<input aria-label="search" class="rz-lookup-search-input" id="@SearchID" @ref="@search" tabindex="-1" placeholder="@SearchTextPlaceholder"
@onchange="@((args) => OnFilter(args))" @onkeydown="@((args) => OnFilterKeyPress(args))" value="@searchText" style="@(ShowSearch ? "" : "margin-right:0px;")"
@oninput=@(args => { searchText = $"{args.Value}"; SearchTextChanged.InvokeAsync(searchText);}) />
@if (ShowSearch)
Expand Down
1 change: 1 addition & 0 deletions Radzen.Blazor/RadzenDropDownDataGrid.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public partial class RadzenDropDownDataGrid<TValue> : DropDownBase<TValue>
/// Specifies additional custom attributes that will be rendered by the input.
/// </summary>
/// <value>The attributes.</value>
[Parameter]
public IReadOnlyDictionary<string, object> InputAttributes { get; set; }

/// <summary>
Expand Down
1 change: 1 addition & 0 deletions Radzen.Blazor/RadzenFileInput.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public partial class RadzenFileInput<TValue> : FormComponent<TValue>
/// Specifies additional custom attributes that will be rendered by the input.
/// </summary>
/// <value>The attributes.</value>
[Parameter]
public IReadOnlyDictionary<string, object> InputAttributes { get; set; }

/// <summary>
Expand Down
1 change: 1 addition & 0 deletions Radzen.Blazor/RadzenNumeric.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public partial class RadzenNumeric<TValue> : FormComponent<TValue>
/// Specifies additional custom attributes that will be rendered by the input.
/// </summary>
/// <value>The attributes.</value>
[Parameter]
public IReadOnlyDictionary<string, object> InputAttributes { get; set; }

/// <summary>
Expand Down
1 change: 1 addition & 0 deletions Radzen.Blazor/RadzenUpload.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public partial class RadzenUpload : RadzenComponent
/// Specifies additional custom attributes that will be rendered by the input.
/// </summary>
/// <value>The attributes.</value>
[Parameter]
public IReadOnlyDictionary<string, object> InputAttributes { get; set; }

/// <summary>
Expand Down
3 changes: 2 additions & 1 deletion RadzenBlazorDemos/Pages/DropDownBindValue.razor
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
@inherits DbContextPage

<div class="rz-p-sm-12 rz-text-align-center">
<RadzenDropDown @bind-Value=@value Data=@companyNames Style="width: 100%; max-width: 400px;" />
<RadzenLabel Text="Select Value" Component="DropDownBindValue" Style="margin-right: 8px; vertical-align: middle;" />
<RadzenDropDown @bind-Value=@value Data=@companyNames Style="width: 100%; max-width: 400px;" Name="DropDownBindValue" />
</div>

@code {
Expand Down
3 changes: 2 additions & 1 deletion RadzenBlazorDemos/Pages/DropDownChangeEvent.razor
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
@inherits DbContextPage

<div class="rz-p-sm-12 rz-text-align-center">
<RadzenDropDown TValue="string" Value=@value Data=@companyNames Change="@(args => value = $"{args}")" Style="width: 100%; max-width: 400px;" />
<RadzenLabel Text="Select Value" Component="DropDownChangeEvent" Style="margin-right: 8px; vertical-align: middle;" />
<RadzenDropDown TValue="string" Value=@value Data=@companyNames Change="@(args => value = $"{args}")" Style="width: 100%; max-width: 400px;" Name="DropDownChangeEvent" />
</div>

@code {
Expand Down
3 changes: 2 additions & 1 deletion RadzenBlazorDemos/Pages/DropDownClear.razor
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
@inherits DbContextPage

<div class="rz-p-sm-12 rz-text-align-center">
<RadzenDropDown @bind-Value=@value Data=@products TextProperty="ProductName" ValueProperty="ProductID" AllowClear=true Placeholder="Select product" Style="width: 100%; max-width: 400px;"/>
<RadzenLabel Text="Select Value" Component="DropDownClear" Style="margin-right: 8px; vertical-align: middle;" />
<RadzenDropDown @bind-Value=@value Data=@products TextProperty="ProductName" ValueProperty="ProductID" AllowClear=true Placeholder="Select product" Style="width: 100%; max-width: 400px;" Name="DropDownClear" />
</div>

@code {
Expand Down
3 changes: 2 additions & 1 deletion RadzenBlazorDemos/Pages/DropDownCustomObjects.razor
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
@using System.ComponentModel.DataAnnotations

<div class="rz-p-sm-12 rz-text-align-center">
<RadzenLabel Text="Select Value" Component="DropDownCustomObjects" Style="margin-right: 8px; vertical-align: middle;" />
<RadzenDropDown Data=@data TValue="MyObject" @bind-Value=@singleValue
AllowClear="true" AllowFiltering="true" Style="width: 100%; max-width: 400px;">
AllowClear="true" AllowFiltering="true" Style="width: 100%; max-width: 400px;" Name="DropDownCustomObjects">
</RadzenDropDown>
</div>

Expand Down
3 changes: 2 additions & 1 deletion RadzenBlazorDemos/Pages/DropDownDataGridBindValue.razor
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
@inherits DbContextPage

<div class="rz-p-12 rz-text-align-center">
<RadzenDropDownDataGrid @bind-Value=@value Data=@companyNames />
<RadzenLabel Text="Select Value" Component="DropDownDataGridBindValue" Style="margin-right: 8px; vertical-align: middle;" />
<RadzenDropDownDataGrid @bind-Value=@value Data=@companyNames Name="DropDownDataGridBindValue" />
</div>

@code {
Expand Down
3 changes: 2 additions & 1 deletion RadzenBlazorDemos/Pages/DropDownDataGridChangeEvent.razor
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
@inherits DbContextPage

<div class="rz-p-12 rz-text-align-center">
<RadzenDropDownDataGrid TValue="string" Value=@value Data=@companyNames Change="@(args => value = $"{args}")" />
<RadzenLabel Text="Select Value" Component="DropDownDataGridChangeEvent" Style="margin-right: 8px; vertical-align: middle;" />
<RadzenDropDownDataGrid TValue="string" Value=@value Data=@companyNames Change="@(args => value = $"{args}")" Name="DropDownDataGridChangeEvent" />
</div>

@code {
Expand Down
Loading

0 comments on commit 0c34028

Please sign in to comment.