1
0
mirror of synced 2024-11-22 13:06:08 +03:00

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:
Jono Mingard 2015-09-28 14:28:59 +13:00 committed by Kevin Brown
parent e08222ef15
commit 9fae3d74e3
3 changed files with 9 additions and 3 deletions

View File

@ -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);

View File

@ -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>'
);

View File

@ -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);
});