1
0
mirror of synced 2024-11-22 04:56:08 +03:00

Render native select out of screen

This closes https://github.com/select2/select2/issues/3065.

Signed-off-by: Kevin Brown <kevin@kevinbrown.in>
This commit is contained in:
penihel 2015-03-31 21:01:29 -03:00 committed by Kevin Brown
parent a993ed9ca9
commit c24293f2ba
8 changed files with 40 additions and 13 deletions

10
dist/css/select2.css vendored
View File

@ -112,6 +112,16 @@
background-color: #fff; background-color: #fff;
filter: alpha(opacity=0); } filter: alpha(opacity=0); }
.select2-hidden-accessible {
border: 0;
clip: rect(0 0 0 0);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px; }
.select2-container--default .select2-selection--single { .select2-container--default .select2-selection--single {
background-color: #fff; background-color: #fff;
border: 1px solid #aaa; border: 1px solid #aaa;

File diff suppressed because one or more lines are too long

View File

@ -4814,7 +4814,8 @@ S2.define('select2/core',[
}); });
// Hide the original select // Hide the original select
$element.hide(); $element.addClass('select2-hidden-accessible');
$element.attr('aria-hidden', 'true');
// Synchronize any monitored attributes // Synchronize any monitored attributes
this._syncAttributes(); this._syncAttributes();
@ -5226,7 +5227,8 @@ S2.define('select2/core',[
this.$element.off('.select2'); this.$element.off('.select2');
this.$element.attr('tabindex', this.$element.data('old-tabindex')); this.$element.attr('tabindex', this.$element.data('old-tabindex'));
this.$element.show(); this.$element.removeClass('select2-hidden-accessible');
this.$element.attr('aria-hidden', 'false');
this.$element.removeData('select2'); this.$element.removeData('select2');
this.dataAdapter.destroy(); this.dataAdapter.destroy();

File diff suppressed because one or more lines are too long

6
dist/js/select2.js vendored
View File

@ -4814,7 +4814,8 @@ S2.define('select2/core',[
}); });
// Hide the original select // Hide the original select
$element.hide(); $element.addClass('select2-hidden-accessible');
$element.attr('aria-hidden', 'true');
// Synchronize any monitored attributes // Synchronize any monitored attributes
this._syncAttributes(); this._syncAttributes();
@ -5226,7 +5227,8 @@ S2.define('select2/core',[
this.$element.off('.select2'); this.$element.off('.select2');
this.$element.attr('tabindex', this.$element.data('old-tabindex')); this.$element.attr('tabindex', this.$element.data('old-tabindex'));
this.$element.show(); this.$element.removeClass('select2-hidden-accessible');
this.$element.attr('aria-hidden', 'false');
this.$element.removeData('select2'); this.$element.removeData('select2');
this.dataAdapter.destroy(); this.dataAdapter.destroy();

File diff suppressed because one or more lines are too long

View File

@ -77,7 +77,8 @@ define([
}); });
// Hide the original select // Hide the original select
$element.hide(); $element.addClass('select2-hidden-accessible');
$element.attr('aria-hidden', 'true');
// Synchronize any monitored attributes // Synchronize any monitored attributes
this._syncAttributes(); this._syncAttributes();
@ -489,7 +490,8 @@ define([
this.$element.off('.select2'); this.$element.off('.select2');
this.$element.attr('tabindex', this.$element.data('old-tabindex')); this.$element.attr('tabindex', this.$element.data('old-tabindex'));
this.$element.show(); this.$element.removeClass('select2-hidden-accessible');
this.$element.attr('aria-hidden', 'false');
this.$element.removeData('select2'); this.$element.removeData('select2');
this.dataAdapter.destroy(); this.dataAdapter.destroy();

View File

@ -33,5 +33,16 @@
filter: alpha(opacity=0); filter: alpha(opacity=0);
} }
.select2-hidden-accessible {
border: 0;
clip: rect(0 0 0 0);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
}
@import "theme/default/layout"; @import "theme/default/layout";
@import "theme/classic/layout"; @import "theme/classic/layout";