From 9fae3d74e373fc646da4e39a0c2ab11efa808c3f Mon Sep 17 00:00:00 2001 From: Jono Mingard Date: Mon, 28 Sep 2015 14:28:59 +1300 Subject: [PATCH] Speak results on selection This closes https://github.com/select2/select2/issues/3735 This closes https://github.com/select2/select2/pull/3821 --- src/js/select2/results.js | 3 ++- src/js/select2/selection/base.js | 2 +- src/js/select2/selection/search.js | 7 ++++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/js/select2/results.js b/src/js/select2/results.js index b43d288c..bca8d2d3 100644 --- a/src/js/select2/results.js +++ b/src/js/select2/results.js @@ -37,7 +37,8 @@ define([ this.hideLoading(); var $message = $( - '
  • ' + '
  • ' ); var message = this.options.get('translations').get(params.message); diff --git a/src/js/select2/selection/base.js b/src/js/select2/selection/base.js index bea67e85..cd3aafda 100644 --- a/src/js/select2/selection/base.js +++ b/src/js/select2/selection/base.js @@ -15,7 +15,7 @@ define([ BaseSelection.prototype.render = function () { var $selection = $( '' ); diff --git a/src/js/select2/selection/search.js b/src/js/select2/selection/search.js index 7dc12a75..77c4edca 100644 --- a/src/js/select2/selection/search.js +++ b/src/js/select2/selection/search.js @@ -12,7 +12,7 @@ define([ '' ); @@ -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); });