|
@@ -10105,11 +10105,31 @@ define('select2/selection/base',[
|
|
BaseSelection.prototype.bind = function (container, $container) {
|
|
BaseSelection.prototype.bind = function (container, $container) {
|
|
var self = this;
|
|
var self = this;
|
|
|
|
|
|
|
|
+ var id = container.id + '-container';
|
|
|
|
+ var resultsId = container.id + '-results';
|
|
|
|
+
|
|
|
|
+ this.$selection.attr('aria-owns', resultsId);
|
|
|
|
+
|
|
|
|
+ this.$selection.on('keydown', function (evt) {
|
|
|
|
+ self.trigger('keypress', evt);
|
|
|
|
+
|
|
|
|
+ if (evt.which === KEYS.SPACE) {
|
|
|
|
+ evt.preventDefault();
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ container.on('results:focus', function (params) {
|
|
|
|
+ self.$selection.attr('aria-activedescendant', params.data._resultId);
|
|
|
|
+ });
|
|
|
|
+
|
|
container.on('selection:update', function (params) {
|
|
container.on('selection:update', function (params) {
|
|
self.update(params.data);
|
|
self.update(params.data);
|
|
});
|
|
});
|
|
|
|
|
|
container.on('open', function () {
|
|
container.on('open', function () {
|
|
|
|
+ // When the dropdown is open, aria-expanded="true"
|
|
|
|
+ self.$selection.attr('aria-expanded', 'true');
|
|
|
|
+
|
|
$(document.body).on('mousedown.select2.' + container.id, function (e) {
|
|
$(document.body).on('mousedown.select2.' + container.id, function (e) {
|
|
var $target = $(e.target);
|
|
var $target = $(e.target);
|
|
|
|
|
|
@@ -10129,10 +10149,16 @@ define('select2/selection/base',[
|
|
$element.select2('close');
|
|
$element.select2('close');
|
|
});
|
|
});
|
|
});
|
|
});
|
|
|
|
+ });
|
|
|
|
|
|
- container.on('close', function () {
|
|
|
|
- $(document.body).off('mousedown.select2.' + container.id);
|
|
|
|
- });
|
|
|
|
|
|
+ container.on('close', function () {
|
|
|
|
+ // When the dropdown is closed, aria-expanded="false"
|
|
|
|
+ self.$selection.attr('aria-expanded', 'false');
|
|
|
|
+ self.$selection.removeAttr('aria-activedescendant');
|
|
|
|
+
|
|
|
|
+ self.$selection.focus();
|
|
|
|
+
|
|
|
|
+ $(document.body).off('mousedown.select2.' + container.id);
|
|
});
|
|
});
|
|
};
|
|
};
|
|
|
|
|
|
@@ -10220,11 +10246,9 @@ define('select2/selection/single',[
|
|
SingleSelection.__super__.bind.apply(this, arguments);
|
|
SingleSelection.__super__.bind.apply(this, arguments);
|
|
|
|
|
|
var id = container.id + '-container';
|
|
var id = container.id + '-container';
|
|
- var resultsId = container.id + '-results';
|
|
|
|
|
|
|
|
this.$selection.find('.rendered-selection').attr('id', id);
|
|
this.$selection.find('.rendered-selection').attr('id', id);
|
|
this.$selection.attr('aria-labelledby', id);
|
|
this.$selection.attr('aria-labelledby', id);
|
|
- this.$selection.attr('aria-owns', resultsId);
|
|
|
|
|
|
|
|
this.$selection.on('mousedown', function (evt) {
|
|
this.$selection.on('mousedown', function (evt) {
|
|
// Only respond to left clicks
|
|
// Only respond to left clicks
|
|
@@ -10237,19 +10261,6 @@ define('select2/selection/single',[
|
|
});
|
|
});
|
|
});
|
|
});
|
|
|
|
|
|
- container.on('open', function () {
|
|
|
|
- // When the dropdown is open, aria-expanded="true"
|
|
|
|
- self.$selection.attr('aria-expanded', 'true');
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- container.on('close', function () {
|
|
|
|
- // When the dropdown is closed, aria-expanded="false"
|
|
|
|
- self.$selection.attr('aria-expanded', 'false');
|
|
|
|
- self.$selection.removeAttr('aria-activedescendant');
|
|
|
|
-
|
|
|
|
- self.$selection.focus();
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
this.$selection.on('focus', function (evt) {
|
|
this.$selection.on('focus', function (evt) {
|
|
// User focuses on the container
|
|
// User focuses on the container
|
|
});
|
|
});
|
|
@@ -10258,18 +10269,6 @@ define('select2/selection/single',[
|
|
// User exits the container
|
|
// User exits the container
|
|
});
|
|
});
|
|
|
|
|
|
- this.$selection.on('keydown', function (evt) {
|
|
|
|
- self.trigger('keypress', evt);
|
|
|
|
-
|
|
|
|
- if (evt.which === KEYS.SPACE) {
|
|
|
|
- evt.preventDefault();
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- container.on('results:focus', function (params) {
|
|
|
|
- self.$selection.attr('aria-activedescendant', params.data._resultId);
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
container.on('selection:update', function (params) {
|
|
container.on('selection:update', function (params) {
|
|
self.update(params.data);
|
|
self.update(params.data);
|
|
});
|
|
});
|
|
@@ -10317,11 +10316,14 @@ define('select2/selection/multiple',[
|
|
|
|
|
|
MultipleSelection.prototype.render = function () {
|
|
MultipleSelection.prototype.render = function () {
|
|
var $selection = $(
|
|
var $selection = $(
|
|
- '<span class="multiple-select">' +
|
|
|
|
|
|
+ '<span class="multiple-select" tabindex="0" role="combobox" ' +
|
|
|
|
+ 'aria-autocomplete="list" aria-haspopup="true" aria-expanded="false">' +
|
|
'<ul class="rendered-selection"></ul>' +
|
|
'<ul class="rendered-selection"></ul>' +
|
|
'</span>'
|
|
'</span>'
|
|
);
|
|
);
|
|
|
|
|
|
|
|
+ $selection.attr('title', this.$element.attr('title'));
|
|
|
|
+
|
|
this.$selection = $selection;
|
|
this.$selection = $selection;
|
|
|
|
|
|
return $selection;
|
|
return $selection;
|