Skip to content

Commit

Permalink
24_1 Accessibility Demo Fixes (#3192)
Browse files Browse the repository at this point in the history
* Filtering Demo Fix

Added aria-label

* Master Detail API Demo Fix

Added alt text

* With List Demo Fix

Added alt text

* Using Intl Demo Fix

Added aria-label

* Row Template Demo Fix

Added roles, alt text and tabindex

* Column Template

Added alt text

* Row Selection Demo Fix

Added alt text

Added visibility switch to hide initial image without src

* Custom New Record Position Demo Fix

Added the text option, that used as icon label text

* PDF Cell Customization Demo Fix

Removed empty caption

* ExcelJS Cell Customization Demo Fix

Removed empty caption

* Filter Panel Demo Fix

Added aria-label

Replaced editor options to an independent JS object

* Filtering API Demo Fix

Added alt texts

* ExcelJS Export Images Demo FIx

Added alt text

* PDF Export Images Demo Fix

Added alt text

* Title Case Remove
  • Loading branch information
dxArtemiusz authored Apr 23, 2024
1 parent 07830ec commit 904d467
Show file tree
Hide file tree
Showing 28 changed files with 94 additions and 50 deletions.
2 changes: 1 addition & 1 deletion MVCDemos/Views/DataGrid/ColumnTemplate.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
.AllowSorting(false)
.CellTemplate(@<text>
<div>
<img src="<%- value %>" alt=""/>
<img src="<%- value %>" alt="Picture of <%- data.FirstName %> <%- data.LastName %>"/>
</div>
</text>);

Expand Down
1 change: 1 addition & 0 deletions MVCDemos/Views/DataGrid/CustomNewRecordPosition.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
.Buttons(b => {
b.Add()
.Icon("add")
.Text("Add")
.OnClick("addButtonClicked")
.Visible(new JS("addButtonVisible"));
b.Add().Name("delete");
Expand Down
1 change: 0 additions & 1 deletion MVCDemos/Views/DataGrid/ExcelJSCellCustomization.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
columns.Add().DataField("Phone")
.Format(new JS("phoneNumberFormat"));
columns.Add().DataField("Website")
.Caption("")
.Alignment(HorizontalAlignment.Center)
.Width(100)
.CellTemplate(@<text>
Expand Down
2 changes: 1 addition & 1 deletion MVCDemos/Views/DataGrid/ExcelJSExportImages.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
.Width(90)
.CellTemplate(@<text>
<div>
<img src="<%- value %>" alt="" />
<img src="<%- value %>" alt="Employee photo"/>
</div>
</text>);

Expand Down
9 changes: 8 additions & 1 deletion MVCDemos/Views/DataGrid/FilterPanel.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
columns.AddFor(m => m.OrderDate);
columns.AddFor(m => m.SaleAmount)
.Format(Format.Currency)
.EditorOptions(new { format = "currency", showClearButton = true })
.EditorOptions(new JS("amountEditorOptions"))
.HeaderFilter(filter => filter.DataSource(new[] {
new {
text = "Less than $3000",
Expand Down Expand Up @@ -73,6 +73,13 @@
)

<script>
var amountEditorOptions = {
format: 'currency',
showClearButton: true,
inputAttr: {
'aria-label': 'Filter cell',
},
};
function calculateFilterExpression() {
return [[getOrderDay, '=', 0], 'or', [getOrderDay, '=', 6]];
}
Expand Down
10 changes: 9 additions & 1 deletion MVCDemos/Views/DataGrid/Filtering.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
columns.AddFor(m => m.SaleAmount)
.Alignment(HorizontalAlignment.Right)
.Format(Format.Currency)
.EditorOptions(new { format = "currency", showClearButton = true })
.EditorOptions(new JS("amountEditorOptions"))
.HeaderFilter(filter => filter.DataSource(new[] {
new {
text = "Less than $3000",
Expand Down Expand Up @@ -150,6 +150,14 @@
</div>

<script>
var amountEditorOptions = {
format: 'currency',
showClearButton: true,
inputAttr: {
'aria-label': 'Filter cell',
},
};
function getOrderDay(rowData) {
return (new Date(rowData.OrderDate)).getDay();
}
Expand Down
4 changes: 2 additions & 2 deletions MVCDemos/Views/DataGrid/FilteringAPI.cshtml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

<div class="left-side">
<div class="logo">
<img src="../../Content/images/DataGrid/logo-devav.png" />
<img src="../../Content/images/DataGrid/logo-tasks.png" />
<img src="../../Content/images/DataGrid/logo-devav.png" alt="DEVAV"/>
<img src="../../Content/images/DataGrid/logo-tasks.png" alt="Tasks"/>
</div>
</div>
<div class="right-side">
Expand Down
2 changes: 1 addition & 1 deletion MVCDemos/Views/DataGrid/MasterDetailAPI.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
md.Enabled(false);
md.Template(@<text>
<div class="employeeInfo">
<img class="employeePhoto" src="<%- data.Picture %>" />
<img class="employeePhoto" alt="Employee photo" src="<%- data.Picture %>" />
<p class="employeeNotes"><%- data.Notes %></p>
</div>
</text>);
Expand Down
1 change: 0 additions & 1 deletion MVCDemos/Views/DataGrid/PDFCellCustomization.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
columns.Add().DataField("Phone")
.Format(new JS("phoneNumberFormat"));
columns.Add().DataField("Website")
.Caption("")
.Alignment(HorizontalAlignment.Center)
.Width(100)
.CellTemplate(@<text>
Expand Down
2 changes: 1 addition & 1 deletion MVCDemos/Views/DataGrid/PDFExportImages.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
.Width(90)
.CellTemplate(@<text>
<div>
<img src="<%- value %>" alt="" />
<img src="<%- value %>" alt="Employee photo" />
</div>
</text>);

Expand Down
4 changes: 2 additions & 2 deletions MVCDemos/Views/DataGrid/RowSelection.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
.OnSelectionChanged("selection_changed")
)
<div id="employeeInfo">
<img class="employeePhoto" />
<img class="employeePhoto" alt="Employee photo" style="visibility: hidden"/>
<p class="employeeNotes"></p>
</div>

Expand All @@ -34,7 +34,7 @@
var data = selectedItems.selectedRowsData[0];
if(data) {
$(".employeeNotes").text(data.Notes);
$(".employeePhoto").attr("src", data.Picture);
$(".employeePhoto").attr("src", data.Picture).attr('style', null);
}
}
</script>
22 changes: 11 additions & 11 deletions MVCDemos/Views/DataGrid/RowTemplate.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@
.RowAlternationEnabled(true)
.HoverStateEnabled(true)
.DataRowTemplate(@<text>
<tr class="main-row">
<td rowspan="2">
<img src="<%- data.Picture %>" alt=""/>
<tr role="row" class="main-row">
<td role="gridcell" rowspan="2">
<img src="<%- data.Picture %>" alt="Picture of <%- data.FirstName %> <%- data.LastName %>" tabindex="0"/>
</td>
<td><%- data.Prefix %></td>
<td><%- data.FirstName %></td>
<td><%- data.LastName %></td>
<td><%- data.Position %></td>
<td><%- formatDate(new Date(data.BirthDate)) %></td>
<td><%- formatDate(new Date(data.HireDate)) %></td>
<td role="gridcell"><%- data.Prefix %></td>
<td role="gridcell"><%- data.FirstName %></td>
<td role="gridcell"><%- data.LastName %></td>
<td role="gridcell"><%- data.Position %></td>
<td role="gridcell"><%- formatDate(new Date(data.BirthDate)) %></td>
<td role="gridcell"><%- formatDate(new Date(data.HireDate)) %></td>
</tr>
<tr class="notes-row">
<td colspan="6">
<tr role="row" class="notes-row">
<td role="gridcell" colspan="6">
<div><%- data.Notes %></div>
</td>
</tr>
Expand Down
2 changes: 1 addition & 1 deletion MVCDemos/Views/FilterBuilder/WithList.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
.DataSourceOptions(d => d.Filter("$('#filterBuilder').dxFilterBuilder('instance').getFilterExpression()"))
.ItemTemplate(@<text>
<div class="product">
<img src="<%- ImageSrc %>">
<img src="<%- ImageSrc %>" alt="Picture of <%- Name %>">
<div><%- Name %></div>
<div class="price"><%- formatCurrency(Price) %></div>
</div>
Expand Down
10 changes: 9 additions & 1 deletion MVCDemos/Views/Localization/UsingIntl.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
.Caption(new JS("formatMessage('Amount')"))
.DataType(GridColumnDataType.Number)
.Format(Format.Currency)
.EditorOptions(new { format = "currency", showClearButton = true });
.EditorOptions(new JS("amountEditorOptions"));
columns.Add().DataField("PaymentDate")
.Caption(new JS("formatMessage('PaymentDate')"))
.DataType(GridColumnDataType.Date);
Expand Down Expand Up @@ -58,6 +58,14 @@
</div>

<script>
var amountEditorOptions = {
format: 'currency',
showClearButton: true,
inputAttr: {
'aria-label': 'Filter cell',
},
};
var dictionary = {
"en": {
"Number": "Number",
Expand Down
2 changes: 1 addition & 1 deletion NetCoreDemos/Views/DataGrid/ColumnTemplate.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
.AllowSorting(false)
.CellTemplate(@<text>
<div>
<img src="<%- value %>" alt=""/>
<img src="<%- value %>" alt="Picture of <%- data.FirstName %> <%- data.LastName %>"/>
</div>
</text>);

Expand Down
1 change: 1 addition & 0 deletions NetCoreDemos/Views/DataGrid/CustomNewRecordPosition.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
.Buttons(b => {
b.Add()
.Icon("add")
.Text("Add")
.OnClick("addButtonClicked")
.Visible(new JS("addButtonVisible"));
b.Add().Name("delete");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
columns.Add().DataField("Phone")
.Format(new JS("phoneNumberFormat"));
columns.Add().DataField("Website")
.Caption("")
.Alignment(HorizontalAlignment.Center)
.Width(100)
.CellTemplate(@<text>
Expand Down
2 changes: 1 addition & 1 deletion NetCoreDemos/Views/DataGrid/ExcelJSExportImages.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
.Width(90)
.CellTemplate(@<text>
<div>
<img src="<%- value %>" alt="" />
<img src="<%- value %>" alt="Employee photo"/>
</div>
</text>);

Expand Down
9 changes: 8 additions & 1 deletion NetCoreDemos/Views/DataGrid/FilterPanel.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
columns.AddFor(m => m.OrderDate);
columns.AddFor(m => m.SaleAmount)
.Format(Format.Currency)
.EditorOptions(new { format = "currency", showClearButton = true })
.EditorOptions(new JS("amountEditorOptions"))
.HeaderFilter(filter => filter.DataSource(new[] {
new {
text = "Less than $3000",
Expand Down Expand Up @@ -73,6 +73,13 @@
)

<script>
var amountEditorOptions = {
format: 'currency',
showClearButton: true,
inputAttr: {
'aria-label': 'Filter cell',
},
};
function calculateFilterExpression() {
return [[getOrderDay, '=', 0], 'or', [getOrderDay, '=', 6]];
}
Expand Down
10 changes: 9 additions & 1 deletion NetCoreDemos/Views/DataGrid/Filtering.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
columns.AddFor(m => m.SaleAmount)
.Alignment(HorizontalAlignment.Right)
.Format(Format.Currency)
.EditorOptions(new { format = "currency", showClearButton = true })
.EditorOptions(new JS("amountEditorOptions"))
.HeaderFilter(filter => filter.DataSource(new[] {
new {
text = "Less than $3000",
Expand Down Expand Up @@ -149,6 +149,14 @@
</div>

<script>
var amountEditorOptions = {
format: 'currency',
showClearButton: true,
inputAttr: {
'aria-label': 'Filter cell',
},
};
function getOrderDay(rowData) {
return (new Date(rowData.OrderDate)).getDay();
}
Expand Down
4 changes: 2 additions & 2 deletions NetCoreDemos/Views/DataGrid/FilteringAPI.cshtml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

<div class="left-side">
<div class="logo">
<img src="~/images/DataGrid/logo-devav.png" />
<img src="~/images/DataGrid/logo-tasks.png" />
<img src="~/images/DataGrid/logo-devav.png" alt="DEVAV" />
<img src="~/images/DataGrid/logo-tasks.png" alt="Tasks" />
</div>
</div>
<div class="right-side">
Expand Down
2 changes: 1 addition & 1 deletion NetCoreDemos/Views/DataGrid/MasterDetailAPI.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
md.Enabled(false);
md.Template(@<text>
<div class="employeeInfo">
<img class="employeePhoto" src="<%- data.Picture %>" />
<img class="employeePhoto" alt="Employee photo" src="<%- data.Picture %>" />
<p class="employeeNotes"><%- data.Notes %></p>
</div>
</text>);
Expand Down
1 change: 0 additions & 1 deletion NetCoreDemos/Views/DataGrid/PDFCellCustomization.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
columns.Add().DataField("Phone")
.Format(new JS("phoneNumberFormat"));
columns.Add().DataField("Website")
.Caption("")
.Alignment(HorizontalAlignment.Center)
.Width(100)
.CellTemplate(@<text>
Expand Down
2 changes: 1 addition & 1 deletion NetCoreDemos/Views/DataGrid/PDFExportImages.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
.Width(90)
.CellTemplate(@<text>
<div>
<img src="<%- value %>" alt="" />
<img src="<%- value %>" alt="Employee photo" />
</div>
</text>);

Expand Down
4 changes: 2 additions & 2 deletions NetCoreDemos/Views/DataGrid/RowSelection.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
.OnSelectionChanged("selection_changed")
)
<div id="employeeInfo">
<img class="employeePhoto" />
<img class="employeePhoto" alt="Employee photo" style="visibility: hidden"/>
<p class="employeeNotes"></p>
</div>

Expand All @@ -34,7 +34,7 @@
var data = selectedItems.selectedRowsData[0];
if(data) {
$(".employeeNotes").text(data.Notes);
$(".employeePhoto").attr("src", data.Picture);
$(".employeePhoto").attr("src", data.Picture).attr('style', null);
}
}
</script>
22 changes: 11 additions & 11 deletions NetCoreDemos/Views/DataGrid/RowTemplate.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@
.RowAlternationEnabled(true)
.HoverStateEnabled(true)
.DataRowTemplate(@<text>
<tr class="main-row">
<td rowspan="2">
<img src="<%- data.Picture %>" alt=""/>
<tr role="row" class="main-row">
<td role="gridcell" rowspan="2">
<img src="<%- data.Picture %>" alt="Picture of <%- data.FirstName %> <%- data.LastName %>" tabindex="0"/>
</td>
<td><%- data.Prefix %></td>
<td><%- data.FirstName %></td>
<td><%- data.LastName %></td>
<td><%- data.Position %></td>
<td><%- formatDate(new Date(data.BirthDate)) %></td>
<td><%- formatDate(new Date(data.HireDate)) %></td>
<td role="gridcell"><%- data.Prefix %></td>
<td role="gridcell"><%- data.FirstName %></td>
<td role="gridcell"><%- data.LastName %></td>
<td role="gridcell"><%- data.Position %></td>
<td role="gridcell"><%- formatDate(new Date(data.BirthDate)) %></td>
<td role="gridcell"><%- formatDate(new Date(data.HireDate)) %></td>
</tr>
<tr class="notes-row">
<td colspan="6">
<tr role="row" class="notes-row">
<td role="gridcell" colspan="6">
<div><%- data.Notes %></div>
</td>
</tr>
Expand Down
2 changes: 1 addition & 1 deletion NetCoreDemos/Views/FilterBuilder/WithList.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
.DataSourceOptions(d => d.Filter("$('#filterBuilder').dxFilterBuilder('instance').getFilterExpression()"))
.ItemTemplate(@<text>
<div class="product">
<img src="<%- ImageSrc %>">
<img src="<%- ImageSrc %>" alt="Picture of <%- Name %>">
<div><%- Name %></div>
<div class="price"><%- formatCurrency(Price) %></div>
</div>
Expand Down
10 changes: 9 additions & 1 deletion NetCoreDemos/Views/Localization/UsingIntl.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
.Caption(new JS("formatMessage('Amount')"))
.DataType(GridColumnDataType.Number)
.Format(Format.Currency)
.EditorOptions(new { format = "currency", showClearButton = true });
.EditorOptions(new JS("amountEditorOptions"));
columns.Add().DataField("PaymentDate")
.Caption(new JS("formatMessage('PaymentDate')"))
.DataType(GridColumnDataType.Date);
Expand Down Expand Up @@ -58,6 +58,14 @@
</div>

<script>
var amountEditorOptions = {
format: 'currency',
showClearButton: true,
inputAttr: {
'aria-label': 'Filter сell',
},
};
var dictionary = {
"en": {
"Number": "Number",
Expand Down

0 comments on commit 904d467

Please sign in to comment.