Add aria-label to project select role without label

This commit is contained in:
Michael Vickers
2020-10-03 10:52:09 +01:00
committed by Frédéric Guillot
parent 87c123bba4
commit 6231c159b8
3 changed files with 11 additions and 1 deletions

View File

@@ -33,6 +33,14 @@ KB.component('project-select-role', function (containerElement, options) {
containerElement.appendChild(componentElement);
}
function getAriaLabelValue() {
if (options.ariaLabel) {
return options.ariaLabel;
}
return '';
}
function buildComponentElement() {
var roles = [];
var container = KB.dom('div');
@@ -49,7 +57,7 @@ KB.component('project-select-role', function (containerElement, options) {
}
}
container.add(KB.dom('select').change(onChange).for('option', roles).build());
container.add(KB.dom('select').attr('aria-label', getAriaLabelValue()).change(onChange).for('option', roles).build());
if (isLoading) {
container.text(' ');