Speak results on selection
This closes https://github.com/select2/select2/issues/3735 This closes https://github.com/select2/select2/pull/3821
This commit is contained in:
parent
e08222ef15
commit
9fae3d74e3
3
src/js/select2/results.js
vendored
3
src/js/select2/results.js
vendored
@ -37,7 +37,8 @@ define([
|
||||
this.hideLoading();
|
||||
|
||||
var $message = $(
|
||||
'<li role="treeitem" class="select2-results__option"></li>'
|
||||
'<li role="treeitem" aria-live="assertive"' +
|
||||
' class="select2-results__option"></li>'
|
||||
);
|
||||
|
||||
var message = this.options.get('translations').get(params.message);
|
||||
|
2
src/js/select2/selection/base.js
vendored
2
src/js/select2/selection/base.js
vendored
@ -15,7 +15,7 @@ define([
|
||||
BaseSelection.prototype.render = function () {
|
||||
var $selection = $(
|
||||
'<span class="select2-selection" role="combobox" ' +
|
||||
'aria-autocomplete="list" aria-haspopup="true" aria-expanded="false">' +
|
||||
' aria-haspopup="true" aria-expanded="false">' +
|
||||
'</span>'
|
||||
);
|
||||
|
||||
|
7
src/js/select2/selection/search.js
vendored
7
src/js/select2/selection/search.js
vendored
@ -12,7 +12,7 @@ define([
|
||||
'<li class="select2-search select2-search--inline">' +
|
||||
'<input class="select2-search__field" type="search" tabindex="-1"' +
|
||||
' autocomplete="off" autocorrect="off" autocapitalize="off"' +
|
||||
' spellcheck="false" role="textbox" />' +
|
||||
' spellcheck="false" role="textbox" aria-autocomplete="list" />' +
|
||||
'</li>'
|
||||
);
|
||||
|
||||
@ -37,6 +37,7 @@ define([
|
||||
|
||||
container.on('close', function () {
|
||||
self.$search.val('');
|
||||
self.$search.removeAttr('aria-activedescendant');
|
||||
self.$search.trigger('focus');
|
||||
});
|
||||
|
||||
@ -54,6 +55,10 @@ define([
|
||||
self.$search.trigger('focus');
|
||||
});
|
||||
|
||||
container.on('results:focus', function (params) {
|
||||
self.$search.attr('aria-activedescendant', params.id);
|
||||
});
|
||||
|
||||
this.$selection.on('focusin', '.select2-search--inline', function (evt) {
|
||||
self.trigger('focus', evt);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user