mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fixed accessibility issue for the missing label from the table header.
This commit is contained in:
committed by
Akshay Joshi
parent
37f55ccc25
commit
4036f2a0f2
@@ -496,9 +496,11 @@ define([
|
||||
e.stopPropagation();
|
||||
},
|
||||
template: _.template([
|
||||
'<% if (label) { %>',
|
||||
'<label class="<%=controlLabelClassName%>" id="<%=cId%>_grplabel"><%=label%></label>',
|
||||
'<% } %>',
|
||||
'<div class="<%=controlsClassName%> <%=extraClasses.join(\' \')%>">',
|
||||
' <div class="btn-group pgadmin-controls-radio-none<% if (disabled) {%> disabled <%}%>" role="radiogroup" aria-labelledby="<%=cId%>_grplabel">',
|
||||
' <div class="btn-group pgadmin-controls-radio-none<% if (disabled) {%> disabled <%}%>" role="radiogroup" <% if (label) {%> aria-labelledby="<%=cId%>_grplabel" <%}%>>',
|
||||
' <% for (var i=0; i < options.length; i++) { %>',
|
||||
' <% var option = options[i]; %>',
|
||||
' <label role="radio" class="btn btn-radiomodern <% if (option.value == value) { %> btn-primary <%} else {%> btn-secondary <%}%> <% if (!option.disabled && !disabled) { %>" tabindex="0"<% } else { %> disabled"<% } %>>',
|
||||
|
@@ -611,6 +611,17 @@ define([
|
||||
this.$el.attr('aria-label', getAriaLabel);
|
||||
}
|
||||
},
|
||||
render: function() {
|
||||
Backgrid.HeaderCell.prototype.render.apply(this, arguments);
|
||||
// If table header label is not present then screen reader will raise
|
||||
// an error we will add span for screen reader only
|
||||
if (this.column.get('label') == '' || !this.column.get('label')) {
|
||||
let getAriaLabel = this.column.get('cellAriaLabel');
|
||||
if (getAriaLabel)
|
||||
this.$el.append(`<span class="sr-only">${getAriaLabel}</span>`);
|
||||
}
|
||||
return this;
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user