Merge pull request #16642 from woocommerce/fix/selectwoomobile

Touchscreen handling in selectWoo
This commit is contained in:
Mike Jolley 2017-08-30 12:17:14 +01:00 committed by GitHub
commit d20ccbe96c
4 changed files with 26 additions and 4 deletions

View File

@ -772,6 +772,14 @@ S2.define('select2/utils',[
$element.append($nodes);
};
// Determine whether the browser is on a touchscreen device.
Utils.isTouchscreen = function() {
if ('undefined' === typeof Utils._isTouchscreenCache) {
Utils._isTouchscreenCache = 'ontouchstart' in document.documentElement;
}
return Utils._isTouchscreenCache;
}
return Utils;
});
@ -5466,7 +5474,10 @@ S2.define('select2/core',[
};
Select2.prototype.focusOnActiveElement = function () {
this.$results.find('li.select2-results__option--highlighted').focus();
// Don't mess with the focus on touchscreens because it causes havoc with on-screen keyboards.
if (! Utils.isTouchscreen()) {
this.$results.find('li.select2-results__option--highlighted').focus();
}
};
Select2.prototype._syncAttributes = function () {

File diff suppressed because one or more lines are too long

View File

@ -772,6 +772,14 @@ S2.define('select2/utils',[
$element.append($nodes);
};
// Determine whether the browser is on a touchscreen device.
Utils.isTouchscreen = function() {
if ('undefined' === typeof Utils._isTouchscreenCache) {
Utils._isTouchscreenCache = 'ontouchstart' in document.documentElement;
}
return Utils._isTouchscreenCache;
}
return Utils;
});
@ -5466,7 +5474,10 @@ S2.define('select2/core',[
};
Select2.prototype.focusOnActiveElement = function () {
this.$results.find('li.select2-results__option--highlighted').focus();
// Don't mess with the focus on touchscreens because it causes havoc with on-screen keyboards.
if (! Utils.isTouchscreen()) {
this.$results.find('li.select2-results__option--highlighted').focus();
}
};
Select2.prototype._syncAttributes = function () {

File diff suppressed because one or more lines are too long