Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Voiceover accessibility improvement #6020

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion dist/js/i18n/it.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/js/i18n/ru.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 17 additions & 7 deletions dist/js/select2.full.js
Original file line number Diff line number Diff line change
Expand Up @@ -1139,6 +1139,9 @@ S2.define('select2/results',[

self.setClasses();

if (!self.options.get('closeOnSelect')) {
this.selection.$search.val('');
}
if (self.options.get('scrollAfterSelect')) {
self.highlightFirstItem();
}
Expand Down Expand Up @@ -1197,6 +1200,9 @@ S2.define('select2/results',[
self.trigger('select', {
data: data
});
if (!self.options.get('closeOnSelect')) {
this.selection.$search.val('');
}
}
});

Expand Down Expand Up @@ -1645,9 +1651,11 @@ S2.define('select2/selection/single',[
return;
}

self.trigger('toggle', {
originalEvent: evt
});
if (!self.container.isOpen()) {
self.trigger('toggle', {
originalEvent: evt
});
}
});

this.$selection.on('focus', function (evt) {
Expand Down Expand Up @@ -1739,9 +1747,11 @@ S2.define('select2/selection/multiple',[
this.$selection.find('.select2-selection__rendered').attr('id', id);

this.$selection.on('click', function (evt) {
self.trigger('toggle', {
originalEvent: evt
});
if (!self.container.isOpen()) {
self.trigger('toggle', {
originalEvent: evt
});
}
});

this.$selection.on(
Expand Down Expand Up @@ -3751,7 +3761,7 @@ S2.define('select2/data/ajax',[
}, function () {
// Attempt to detect if a request was aborted
// Only works if the transport exposes a status property
if ('status' in $request &&
if ($request && 'status' in $request &&
($request.status === 0 || $request.status === '0')) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion dist/js/select2.full.min.js

Large diffs are not rendered by default.

24 changes: 17 additions & 7 deletions dist/js/select2.js
Original file line number Diff line number Diff line change
Expand Up @@ -1139,6 +1139,9 @@ S2.define('select2/results',[

self.setClasses();

if (!self.options.get('closeOnSelect')) {
this.selection.$search.val('');
}
if (self.options.get('scrollAfterSelect')) {
self.highlightFirstItem();
}
Expand Down Expand Up @@ -1197,6 +1200,9 @@ S2.define('select2/results',[
self.trigger('select', {
data: data
});
if (!self.options.get('closeOnSelect')) {
this.selection.$search.val('');
}
}
});

Expand Down Expand Up @@ -1645,9 +1651,11 @@ S2.define('select2/selection/single',[
return;
}

self.trigger('toggle', {
originalEvent: evt
});
if (!self.container.isOpen()) {
self.trigger('toggle', {
originalEvent: evt
});
}
});

this.$selection.on('focus', function (evt) {
Expand Down Expand Up @@ -1739,9 +1747,11 @@ S2.define('select2/selection/multiple',[
this.$selection.find('.select2-selection__rendered').attr('id', id);

this.$selection.on('click', function (evt) {
self.trigger('toggle', {
originalEvent: evt
});
if (!self.container.isOpen()) {
self.trigger('toggle', {
originalEvent: evt
});
}
});

this.$selection.on(
Expand Down Expand Up @@ -3751,7 +3761,7 @@ S2.define('select2/data/ajax',[
}, function () {
// Attempt to detect if a request was aborted
// Only works if the transport exposes a status property
if ('status' in $request &&
if ($request && 'status' in $request &&
($request.status === 0 || $request.status === '0')) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion dist/js/select2.min.js

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,5 @@
"grunt-sass": "^2.1.0",
"jquery-mousewheel": "~3.1.13",
"node-sass": "^4.12.0"
},
"dependencies": {}
}
}
6 changes: 6 additions & 0 deletions src/js/select2/results.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,9 @@ define([

self.setClasses();

if (!self.options.get('closeOnSelect')) {
this.selection.$search.val('');
}
if (self.options.get('scrollAfterSelect')) {
self.highlightFirstItem();
}
Expand Down Expand Up @@ -346,6 +349,9 @@ define([
self.trigger('select', {
data: data
});
if (!self.options.get('closeOnSelect')) {
this.selection.$search.val('');
}
}
});

Expand Down
8 changes: 5 additions & 3 deletions src/js/select2/selection/multiple.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ define([
this.$selection.find('.select2-selection__rendered').attr('id', id);

this.$selection.on('click', function (evt) {
self.trigger('toggle', {
originalEvent: evt
});
if (!self.container.isOpen()) {
self.trigger('toggle', {
originalEvent: evt
});
}
});

this.$selection.on(
Expand Down
2 changes: 1 addition & 1 deletion src/js/select2/selection/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ define([

decorated.call(this, container, $container);

self.$search.attr('aria-describedby', selectionId);
self.$search.attr('aria-describedby', container.id + '-label ' + selectionId);

container.on('open', function () {
self.$search.attr('aria-controls', resultsId);
Expand Down
8 changes: 5 additions & 3 deletions src/js/select2/selection/single.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,11 @@ define([
return;
}

self.trigger('toggle', {
originalEvent: evt
});
if (!self.container.isOpen()) {
self.trigger('toggle', {
originalEvent: evt
});
}
});

this.$selection.on('focus', function (evt) {
Expand Down