Added aria-label to provide an invisible label where a visible label cannot be used. Fixes #4772.

This commit is contained in:
Aditya Toshniwal
2019-12-03 12:47:42 +05:30
committed by Akshay Joshi
parent d476343b99
commit 0a67b2ecb9
16 changed files with 201 additions and 72 deletions

View File

@@ -541,11 +541,13 @@
id: _.uniqueId('bf_')
},
template: _.template([
'<label class="<%=Backform.controlLabelClassName%>"><%=controlLabel%></label>',
'<label class="<%=Backform.controlLabelClassName%>" for="<%=id%>"><%=controlLabel%></label>',
'<div class="<%=Backform.controlContainerClassName%>">',
' <div class="form-check">',
' <input type="<%=type%>" class="form-check-input <%=extraClasses.join(\' \')%>" id="<%=id%>" name="<%=name%>" <%=value ? "checked=\'checked\'" : ""%> <%=disabled ? "disabled" : ""%> <%=required ? "required" : ""%> />',
' <label class="form-check-label" for="<%=id%>"><%=label%></label>',
' <% if (label && label.length) { %>',
' <label class="form-check-label" for="<%=id%>"><%=label%></label>',
' <% } %>',
' </div>',
'</div>'
].join("\n")),

View File

@@ -2190,6 +2190,39 @@ var HeaderCell = Backgrid.HeaderCell = Backbone.View.extend({
});
/**
EmptyHeaderCell is a special cell class that renders a column header cell.
The text is empty here and it is not sortable.
@class Backgrid.EmptyHeaderCell
@extends Backbone.View
*/
var EmptyHeaderCell = Backgrid.EmptyHeaderCell = Backbone.View.extend({
/** @property */
tagName: "td",
/**
Initializer.
@param {Object} options
@param {Backgrid.Column|Object} options.column
*/
initialize: function (options) {
this.column = options.column;
},
/**
Renders a empty header cell with no events
*/
render: function () {
this.$el.empty();
this.$el.addClass(this.column.get("name"));
this.$el.addClass("renderable");
return this;
}
});
/**
HeaderRow is a controller for a row of header cells.
@@ -2215,7 +2248,13 @@ var HeaderRow = Backgrid.HeaderRow = Backgrid.Row.extend({
},
makeCell: function (column, options) {
var headerCell = column.get("headerCell") || options.headerCell || HeaderCell;
var headerCell = null;
if(column.get("label") === "" || !column.get("label")) {
headerCell = column.get("headerCell") || options.headerCell || EmptyHeaderCell;
} else {
headerCell = column.get("headerCell") || options.headerCell || HeaderCell;
}
headerCell = new headerCell({
column: column,
collection: this.collection