Pager: set ariaDisabled property to stop Edge crash. Fixes #1303

This commit is contained in:
Rob Garrison 2016-11-26 09:57:00 -06:00
parent 12cde473d3
commit 4053331c13
2 changed files with 27 additions and 17 deletions

View File

@ -128,16 +128,25 @@
// hide arrows at extremes // hide arrows at extremes
pagerArrows = function( table, p, disable ) { pagerArrows = function( table, p, disable ) {
var a = 'addClass', var tmp,
r = 'removeClass', a = 'addClass',
d = p.cssDisabled, r = 'removeClass',
dis = !!disable, d = p.cssDisabled,
first = ( dis || p.page === 0 ), dis = !!disable,
tp = getTotalPages( table, p ), first = ( dis || p.page === 0 ),
last = ( dis || (p.page === tp - 1) || tp === 0 ); tp = getTotalPages( table, p ),
last = ( dis || (p.page === tp - 1) || tp === 0 );
if ( p.updateArrows ) { if ( p.updateArrows ) {
p.$container.find(p.cssFirst + ',' + p.cssPrev)[ first ? a : r ](d).attr('aria-disabled', first); tmp = p.$container.find(p.cssFirst + ',' + p.cssPrev);
p.$container.find(p.cssNext + ',' + p.cssLast)[ last ? a : r ](d).attr('aria-disabled', last); tmp[ first ? a : r ](d); // toggle disabled class
tmp.each(function(){
this.ariaDisabled = first;
});
tmp = p.$container.find(p.cssNext + ',' + p.cssLast)
tmp[ last ? a : r ](d)
tmp.each(function(){
this.ariaDisabled = last;
});
} }
}, },
@ -689,9 +698,8 @@
.add( p.$container.find( '.ts-startRow, .ts-page' ) ); .add( p.$container.find( '.ts-startRow, .ts-page' ) );
len = $controls.length; len = $controls.length;
for ( index = 0; index < len; index++ ) { for ( index = 0; index < len; index++ ) {
$controls.eq( index ) $controls.eq( index ).addClass( p.cssDisabled )[0].disabled = true;
.attr( 'aria-disabled', 'true' ) $controls[ index ].ariaDisabled = true;
.addClass( p.cssDisabled )[0].disabled = true;
} }
}, },
@ -876,7 +884,9 @@
p.$size.add(p.$goto).add(p.$container.find('.ts-startRow, .ts-page')) p.$size.add(p.$goto).add(p.$container.find('.ts-startRow, .ts-page'))
.removeClass(p.cssDisabled) .removeClass(p.cssDisabled)
.removeAttr('disabled') .removeAttr('disabled')
.attr('aria-disabled', 'false'); .each(function(){
this.ariaDisabled = false;
});
p.isDisabled = false; p.isDisabled = false;
p.page = $.data(table, 'pagerLastPage') || p.page || 0; p.page = $.data(table, 'pagerLastPage') || p.page || 0;
size = p.$size.find('option[selected]').val(); size = p.$size.find('option[selected]').val();

View File

@ -404,11 +404,11 @@
p.$container p.$container
.find( s.first + ',' + s.prev ) .find( s.first + ',' + s.prev )
.toggleClass( wo.pager_css.disabled, first ) .toggleClass( wo.pager_css.disabled, first )
.attr( 'aria-disabled', first ); .prop( 'aria-disabled', first );
p.$container p.$container
.find( s.next + ',' + s.last ) .find( s.next + ',' + s.last )
.toggleClass( wo.pager_css.disabled, last ) .toggleClass( wo.pager_css.disabled, last )
.attr( 'aria-disabled', last ); .prop( 'aria-disabled', last );
} }
}, },
@ -451,7 +451,7 @@
.add( p.$goto ) .add( p.$goto )
.removeClass( wo.pager_css.disabled ) .removeClass( wo.pager_css.disabled )
.removeAttr( 'disabled' ) .removeAttr( 'disabled' )
.attr( 'aria-disabled', 'false' ); .prop( 'aria-disabled', 'false' );
p.totalPages = Math.ceil( p.totalRows / sz ); // needed for 'pageSize' method p.totalPages = Math.ceil( p.totalRows / sz ); // needed for 'pageSize' method
c.totalRows = p.totalRows; c.totalRows = p.totalRows;
tsp.parsePageNumber( c, p ); tsp.parsePageNumber( c, p );
@ -1012,7 +1012,7 @@
len = $controls.length; len = $controls.length;
for ( index = 0; index < len; index++ ) { for ( index = 0; index < len; index++ ) {
$controls.eq( index ) $controls.eq( index )
.attr( 'aria-disabled', 'true' ) .prop( 'aria-disabled', 'true' )
.addClass( wo.pager_css.disabled )[ 0 ].disabled = true; .addClass( wo.pager_css.disabled )[ 0 ].disabled = true;
} }
}, },