mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2024-11-22 00:37:36 -06:00
Fixed some accessibility issues:
1) Screen reader to read elements in radio modern control. 2) Aria-label additions at few missing places. 3) Radiocontrol to have different ids for each option.
This commit is contained in:
parent
1bd14895c3
commit
6586be5158
@ -496,13 +496,13 @@ define([
|
||||
e.stopPropagation();
|
||||
},
|
||||
template: _.template([
|
||||
'<label class="<%=controlLabelClassName%>"><%=label%></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 <%}%>" >',
|
||||
' <div class="btn-group pgadmin-controls-radio-none<% if (disabled) {%> disabled <%}%>" role="radiogroup" aria-labelledby="<%=cId%>_grplabel">',
|
||||
' <% for (var i=0; i < options.length; i++) { %>',
|
||||
' <% var option = options[i]; %>',
|
||||
' <label class="btn btn-radiomodern <% if (option.value == value) { %> btn-primary <%} else {%> btn-secondary <%}%> <% if (!option.disabled && !disabled) { %>" tabindex="0"<% } else { %> disabled"<% } %>>',
|
||||
' <i class="fa fa-check <% if (option.value != value) { %>visibility-hidden <%}%>"></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"<% } %>>',
|
||||
' <i class="fa fa-check <% if (option.value != value) { %>visibility-hidden <%}%>" role="img"></i>',
|
||||
' <input type="radio" name="<%=name%>" autocomplete="off" value=<%-formatter.fromRaw(option.value)%> <% if (option.value == value) { %> checked<%}%> <% if (option.disabled || disabled) { %> disabled <%}%>> <%-option.label%>',
|
||||
' </label>',
|
||||
' <% } %>',
|
||||
@ -540,6 +540,7 @@ define([
|
||||
required: evalF(data.required, data, this.model),
|
||||
}); // Clean up first
|
||||
|
||||
data.cId = data.cId || _.uniqueId('pgC_');
|
||||
data.options = _.isFunction(data.options) ?
|
||||
data.options.apply(data, [this.model]) : data.options;
|
||||
|
||||
|
@ -432,7 +432,7 @@ define([
|
||||
|
||||
if (editable) {
|
||||
this.$el.html(
|
||||
'<i class=\'fa fa-pencil-square subnode-edit-in-process\' title=\'' + _('Edit row') + '\'></i>'
|
||||
'<i class=\'fa fa-pencil-square subnode-edit-in-process\' title=\'' + _('Edit row') + '\' aria-label=\'' + _('Edit row') + '\'></i>'
|
||||
);
|
||||
let body = $(this.$el).parents()[1],
|
||||
container = $(body).find('.tab-content:first > .tab-pane.active:first');
|
||||
@ -451,7 +451,7 @@ define([
|
||||
},
|
||||
render: function() {
|
||||
this.$el.empty();
|
||||
this.$el.html('<i class=\'fa fa-pencil-square-o\' title=\'' + _('Edit row') + '\'></i>');
|
||||
this.$el.html('<i class=\'fa fa-pencil-square-o\' title=\'' + _('Edit row') + '\' aria-label=\'' + _('Edit row') + '\'></i>');
|
||||
this.delegateEvents();
|
||||
if (this.grabFocus)
|
||||
this.$el.trigger('focus');
|
||||
@ -603,9 +603,13 @@ define([
|
||||
// Here, we will add custom classes to header cell
|
||||
Backgrid.HeaderCell.prototype.initialize.apply(this, arguments);
|
||||
var getClassName = this.column.get('cellHeaderClasses');
|
||||
var getAriaLabel = this.column.get('cellAriaLabel');
|
||||
if (getClassName) {
|
||||
this.$el.addClass(getClassName);
|
||||
}
|
||||
if (getAriaLabel) {
|
||||
this.$el.attr('aria-label', getAriaLabel);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -581,8 +581,8 @@
|
||||
' <% var option = options[i]; %>',
|
||||
' <% var id = _.uniqueId("bf_"); %>',
|
||||
' <div class="custom-control custom-radio">',
|
||||
' <input type="<%=type%>" class="custom-control-input <%=extraClasses.join(\' \')%>" id="<%=cId%>" name="<%=name%>" value="<%-formatter.fromRaw(option.value)%>" <%=rawValue == option.value ? "checked=\'checked\'" : ""%> <%=disabled ? "disabled" : ""%> <%=readonly ? "disabled" : ""%> <%=required ? "required" : ""%> />',
|
||||
' <label class="custom-control-label" for="<%=cId%>"><%-option.label%></label>',
|
||||
' <input type="<%=type%>" class="custom-control-input <%=extraClasses.join(\' \')%>" id="<%=cId%><%=i%>" name="<%=name%>" value="<%-formatter.fromRaw(option.value)%>" <%=rawValue == option.value ? "checked=\'checked\'" : ""%> <%=disabled ? "disabled" : ""%> <%=readonly ? "disabled" : ""%> <%=required ? "required" : ""%> />',
|
||||
' <label class="custom-control-label" for="<%=cId%><%=i%>"><%-option.label%></label>',
|
||||
' </div>',
|
||||
' <% } %>',
|
||||
' <% if (helpMessage && helpMessage.length) { %>',
|
||||
|
Loading…
Reference in New Issue
Block a user