فهرست منبع

Only use `aria-owns` when the dropdown is open

This fixes part of https://github.com/select2/select2/issues/3144.
Kevin Brown 10 سال پیش
والد
کامیت
fc43f00b59
5فایلهای تغییر یافته به همراه8 افزوده شده و 6 حذف شده
  1. 3 2
      dist/js/select2.full.js
  2. 0 0
      dist/js/select2.full.min.js
  3. 3 2
      dist/js/select2.js
  4. 0 0
      dist/js/select2.min.js
  5. 2 2
      src/js/select2/selection/base.js

+ 3 - 2
dist/js/select2.full.js

@@ -1293,8 +1293,6 @@ S2.define('select2/selection/base',[
 
     this.container = container;
 
-    this.$selection.attr('aria-owns', resultsId);
-
     this.$selection.on('focus', function (evt) {
       self.trigger('focus', evt);
     });
@@ -1322,6 +1320,7 @@ S2.define('select2/selection/base',[
     container.on('open', function () {
       // When the dropdown is open, aria-expanded="true"
       self.$selection.attr('aria-expanded', 'true');
+      self.$selection.attr('aria-owns', resultsId);
 
       self._attachCloseHandler(container);
     });
@@ -1330,6 +1329,7 @@ S2.define('select2/selection/base',[
       // When the dropdown is closed, aria-expanded="false"
       self.$selection.attr('aria-expanded', 'false');
       self.$selection.removeAttr('aria-activedescendant');
+      self.$selection.removeAttr('aria-owns');
 
       self.$selection.focus();
 
@@ -4201,6 +4201,7 @@ S2.define('select2/i18n/en',[],function () {
 S2.define('select2/defaults',[
   'jquery',
   'require',
+
   './results',
 
   './selection/single',

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 0 - 0
dist/js/select2.full.min.js


+ 3 - 2
dist/js/select2.js

@@ -1293,8 +1293,6 @@ S2.define('select2/selection/base',[
 
     this.container = container;
 
-    this.$selection.attr('aria-owns', resultsId);
-
     this.$selection.on('focus', function (evt) {
       self.trigger('focus', evt);
     });
@@ -1322,6 +1320,7 @@ S2.define('select2/selection/base',[
     container.on('open', function () {
       // When the dropdown is open, aria-expanded="true"
       self.$selection.attr('aria-expanded', 'true');
+      self.$selection.attr('aria-owns', resultsId);
 
       self._attachCloseHandler(container);
     });
@@ -1330,6 +1329,7 @@ S2.define('select2/selection/base',[
       // When the dropdown is closed, aria-expanded="false"
       self.$selection.attr('aria-expanded', 'false');
       self.$selection.removeAttr('aria-activedescendant');
+      self.$selection.removeAttr('aria-owns');
 
       self.$selection.focus();
 
@@ -4201,6 +4201,7 @@ S2.define('select2/i18n/en',[],function () {
 S2.define('select2/defaults',[
   'jquery',
   'require',
+
   './results',
 
   './selection/single',

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 0 - 0
dist/js/select2.min.js


+ 2 - 2
src/js/select2/selection/base.js

@@ -43,8 +43,6 @@ define([
 
     this.container = container;
 
-    this.$selection.attr('aria-owns', resultsId);
-
     this.$selection.on('focus', function (evt) {
       self.trigger('focus', evt);
     });
@@ -72,6 +70,7 @@ define([
     container.on('open', function () {
       // When the dropdown is open, aria-expanded="true"
       self.$selection.attr('aria-expanded', 'true');
+      self.$selection.attr('aria-owns', resultsId);
 
       self._attachCloseHandler(container);
     });
@@ -80,6 +79,7 @@ define([
       // When the dropdown is closed, aria-expanded="false"
       self.$selection.attr('aria-expanded', 'false');
       self.$selection.removeAttr('aria-activedescendant');
+      self.$selection.removeAttr('aria-owns');
 
       self.$selection.focus();
 

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است