Only use aria-owns
when the dropdown is open
This fixes part of https://github.com/select2/select2/issues/3144.
This commit is contained in:
parent
7e4e8bc9d6
commit
fc43f00b59
5
dist/js/select2.full.js
vendored
5
dist/js/select2.full.js
vendored
@ -1293,8 +1293,6 @@ S2.define('select2/selection/base',[
|
|||||||
|
|
||||||
this.container = container;
|
this.container = container;
|
||||||
|
|
||||||
this.$selection.attr('aria-owns', resultsId);
|
|
||||||
|
|
||||||
this.$selection.on('focus', function (evt) {
|
this.$selection.on('focus', function (evt) {
|
||||||
self.trigger('focus', evt);
|
self.trigger('focus', evt);
|
||||||
});
|
});
|
||||||
@ -1322,6 +1320,7 @@ S2.define('select2/selection/base',[
|
|||||||
container.on('open', function () {
|
container.on('open', function () {
|
||||||
// When the dropdown is open, aria-expanded="true"
|
// When the dropdown is open, aria-expanded="true"
|
||||||
self.$selection.attr('aria-expanded', 'true');
|
self.$selection.attr('aria-expanded', 'true');
|
||||||
|
self.$selection.attr('aria-owns', resultsId);
|
||||||
|
|
||||||
self._attachCloseHandler(container);
|
self._attachCloseHandler(container);
|
||||||
});
|
});
|
||||||
@ -1330,6 +1329,7 @@ S2.define('select2/selection/base',[
|
|||||||
// When the dropdown is closed, aria-expanded="false"
|
// When the dropdown is closed, aria-expanded="false"
|
||||||
self.$selection.attr('aria-expanded', 'false');
|
self.$selection.attr('aria-expanded', 'false');
|
||||||
self.$selection.removeAttr('aria-activedescendant');
|
self.$selection.removeAttr('aria-activedescendant');
|
||||||
|
self.$selection.removeAttr('aria-owns');
|
||||||
|
|
||||||
self.$selection.focus();
|
self.$selection.focus();
|
||||||
|
|
||||||
@ -4201,6 +4201,7 @@ S2.define('select2/i18n/en',[],function () {
|
|||||||
S2.define('select2/defaults',[
|
S2.define('select2/defaults',[
|
||||||
'jquery',
|
'jquery',
|
||||||
'require',
|
'require',
|
||||||
|
|
||||||
'./results',
|
'./results',
|
||||||
|
|
||||||
'./selection/single',
|
'./selection/single',
|
||||||
|
2
dist/js/select2.full.min.js
vendored
2
dist/js/select2.full.min.js
vendored
File diff suppressed because one or more lines are too long
5
dist/js/select2.js
vendored
5
dist/js/select2.js
vendored
@ -1293,8 +1293,6 @@ S2.define('select2/selection/base',[
|
|||||||
|
|
||||||
this.container = container;
|
this.container = container;
|
||||||
|
|
||||||
this.$selection.attr('aria-owns', resultsId);
|
|
||||||
|
|
||||||
this.$selection.on('focus', function (evt) {
|
this.$selection.on('focus', function (evt) {
|
||||||
self.trigger('focus', evt);
|
self.trigger('focus', evt);
|
||||||
});
|
});
|
||||||
@ -1322,6 +1320,7 @@ S2.define('select2/selection/base',[
|
|||||||
container.on('open', function () {
|
container.on('open', function () {
|
||||||
// When the dropdown is open, aria-expanded="true"
|
// When the dropdown is open, aria-expanded="true"
|
||||||
self.$selection.attr('aria-expanded', 'true');
|
self.$selection.attr('aria-expanded', 'true');
|
||||||
|
self.$selection.attr('aria-owns', resultsId);
|
||||||
|
|
||||||
self._attachCloseHandler(container);
|
self._attachCloseHandler(container);
|
||||||
});
|
});
|
||||||
@ -1330,6 +1329,7 @@ S2.define('select2/selection/base',[
|
|||||||
// When the dropdown is closed, aria-expanded="false"
|
// When the dropdown is closed, aria-expanded="false"
|
||||||
self.$selection.attr('aria-expanded', 'false');
|
self.$selection.attr('aria-expanded', 'false');
|
||||||
self.$selection.removeAttr('aria-activedescendant');
|
self.$selection.removeAttr('aria-activedescendant');
|
||||||
|
self.$selection.removeAttr('aria-owns');
|
||||||
|
|
||||||
self.$selection.focus();
|
self.$selection.focus();
|
||||||
|
|
||||||
@ -4201,6 +4201,7 @@ S2.define('select2/i18n/en',[],function () {
|
|||||||
S2.define('select2/defaults',[
|
S2.define('select2/defaults',[
|
||||||
'jquery',
|
'jquery',
|
||||||
'require',
|
'require',
|
||||||
|
|
||||||
'./results',
|
'./results',
|
||||||
|
|
||||||
'./selection/single',
|
'./selection/single',
|
||||||
|
2
dist/js/select2.min.js
vendored
2
dist/js/select2.min.js
vendored
File diff suppressed because one or more lines are too long
4
src/js/select2/selection/base.js
vendored
4
src/js/select2/selection/base.js
vendored
@ -43,8 +43,6 @@ define([
|
|||||||
|
|
||||||
this.container = container;
|
this.container = container;
|
||||||
|
|
||||||
this.$selection.attr('aria-owns', resultsId);
|
|
||||||
|
|
||||||
this.$selection.on('focus', function (evt) {
|
this.$selection.on('focus', function (evt) {
|
||||||
self.trigger('focus', evt);
|
self.trigger('focus', evt);
|
||||||
});
|
});
|
||||||
@ -72,6 +70,7 @@ define([
|
|||||||
container.on('open', function () {
|
container.on('open', function () {
|
||||||
// When the dropdown is open, aria-expanded="true"
|
// When the dropdown is open, aria-expanded="true"
|
||||||
self.$selection.attr('aria-expanded', 'true');
|
self.$selection.attr('aria-expanded', 'true');
|
||||||
|
self.$selection.attr('aria-owns', resultsId);
|
||||||
|
|
||||||
self._attachCloseHandler(container);
|
self._attachCloseHandler(container);
|
||||||
});
|
});
|
||||||
@ -80,6 +79,7 @@ define([
|
|||||||
// When the dropdown is closed, aria-expanded="false"
|
// When the dropdown is closed, aria-expanded="false"
|
||||||
self.$selection.attr('aria-expanded', 'false');
|
self.$selection.attr('aria-expanded', 'false');
|
||||||
self.$selection.removeAttr('aria-activedescendant');
|
self.$selection.removeAttr('aria-activedescendant');
|
||||||
|
self.$selection.removeAttr('aria-owns');
|
||||||
|
|
||||||
self.$selection.focus();
|
self.$selection.focus();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user