Skip to content

Commit

Permalink
93a604c3276e8a2a8cdb26e6bacdfdf37dc37f02 Fix: Accessability improveme…
Browse files Browse the repository at this point in the history
…nts with additional ARIA attributes for paging control

https://datatables.net/forums/discussion/75174

Sync to source repo @93a604c3276e8a2a8cdb26e6bacdfdf37dc37f02
  • Loading branch information
AllanJard committed Jan 20, 2023
1 parent fc30dd4 commit 836f04f
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion datatables.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
],
"src-repo": "http://github.com/DataTables/DataTablesSrc",
"last-tag": "1.13.1",
"last-sync": "5a8a613c703eb99333358257c46406aaf1076076"
"last-sync": "93a604c3276e8a2a8cdb26e6bacdfdf37dc37f02"
}
7 changes: 6 additions & 1 deletion js/dataTables.bootstrap4.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,16 +135,21 @@ DataTable.ext.renderer.pageButton.bootstrap = function ( settings, host, idx, bu
}

if ( btnDisplay ) {
var disabled = btnClass.indexOf('disabled') !== -1;

node = $('<li>', {
'class': classes.sPageButton+' '+btnClass,
'id': idx === 0 && typeof button === 'string' ?
settings.sTableId +'_'+ button :
null
} )
.append( $('<a>', {
'href': '#',
'href': disabled ? null : '#',
'aria-controls': settings.sTableId,
'aria-disabled': disabled ? 'true' : null,
'aria-label': aria[ button ],
'aria-role': 'link',
'aria-current': btnClass === 'active' ? 'page' : null,
'data-dt-idx': button,
'tabindex': settings.iTabIndex,
'class': 'page-link'
Expand Down
2 changes: 1 addition & 1 deletion js/dataTables.bootstrap4.min.js

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

2 changes: 1 addition & 1 deletion js/dataTables.bootstrap4.min.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! DataTables Bootstrap 4 integration
* ©2011-2017 SpryMedia Ltd - datatables.net/license
*/
import $ from"jquery";import DataTable from"datatables.net";$.extend(!0,DataTable.defaults,{dom:"<'row'<'col-sm-12 col-md-6'l><'col-sm-12 col-md-6'f>><'row'<'col-sm-12'tr>><'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>",renderer:"bootstrap"}),$.extend(DataTable.ext.classes,{sWrapper:"dataTables_wrapper dt-bootstrap4",sFilterInput:"form-control form-control-sm",sLengthSelect:"custom-select custom-select-sm form-control form-control-sm",sProcessing:"dataTables_processing card",sPageButton:"paginate_button page-item"}),DataTable.ext.renderer.pageButton.bootstrap=function(i,a,d,e,n,c){function p(a,e){function t(a){a.preventDefault(),$(a.currentTarget).hasClass("disabled")||u.page()==a.data.action||u.page(a.data.action).draw("page")}for(var s,o,r=0,l=e.length;r<l;r++)if(o=e[r],Array.isArray(o))p(a,o);else{switch(m=b="",o){case"ellipsis":b="&#x2026;",m="disabled";break;case"first":b=f.sFirst,m=o+(0<n?"":" disabled");break;case"previous":b=f.sPrevious,m=o+(0<n?"":" disabled");break;case"next":b=f.sNext,m=o+(n<c-1?"":" disabled");break;case"last":b=f.sLast,m=o+(n<c-1?"":" disabled");break;default:b=o+1,m=n===o?"active":""}b&&(s=$("<li>",{class:g.sPageButton+" "+m,id:0===d&&"string"==typeof o?i.sTableId+"_"+o:null}).append($("<a>",{href:"#","aria-controls":i.sTableId,"aria-label":x[o],"data-dt-idx":o,tabindex:i.iTabIndex,class:"page-link"}).html(b)).appendTo(a),i.oApi._fnBindAction(s,{action:o},t))}}var b,m,t,u=new DataTable.Api(i),g=i.oClasses,f=i.oLanguage.oPaginate,x=i.oLanguage.oAria.paginate||{};try{t=$(a).find(document.activeElement).data("dt-idx")}catch(a){}p($(a).empty().html('<ul class="pagination"/>').children("ul"),e),void 0!==t&&$(a).find("[data-dt-idx="+t+"]").trigger("focus")};export default DataTable;
import $ from"jquery";import DataTable from"datatables.net";$.extend(!0,DataTable.defaults,{dom:"<'row'<'col-sm-12 col-md-6'l><'col-sm-12 col-md-6'f>><'row'<'col-sm-12'tr>><'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>",renderer:"bootstrap"}),$.extend(DataTable.ext.classes,{sWrapper:"dataTables_wrapper dt-bootstrap4",sFilterInput:"form-control form-control-sm",sLengthSelect:"custom-select custom-select-sm form-control form-control-sm",sProcessing:"dataTables_processing card",sPageButton:"paginate_button page-item"}),DataTable.ext.renderer.pageButton.bootstrap=function(i,a,n,e,d,c){function p(a,e){function t(a){a.preventDefault(),$(a.currentTarget).hasClass("disabled")||m.page()==a.data.action||m.page(a.data.action).draw("page")}for(var s,l,r=0,o=e.length;r<o;r++)if(s=e[r],Array.isArray(s))p(a,s);else{switch(u=b="",s){case"ellipsis":b="&#x2026;",u="disabled";break;case"first":b=f.sFirst,u=s+(0<d?"":" disabled");break;case"previous":b=f.sPrevious,u=s+(0<d?"":" disabled");break;case"next":b=f.sNext,u=s+(d<c-1?"":" disabled");break;case"last":b=f.sLast,u=s+(d<c-1?"":" disabled");break;default:b=s+1,u=d===s?"active":""}b&&(l=-1!==u.indexOf("disabled"),l=$("<li>",{class:g.sPageButton+" "+u,id:0===n&&"string"==typeof s?i.sTableId+"_"+s:null}).append($("<a>",{href:l?null:"#","aria-controls":i.sTableId,"aria-disabled":l?"true":null,"aria-label":x[s],"aria-role":"link","aria-current":"active"===u?"page":null,"data-dt-idx":s,tabindex:i.iTabIndex,class:"page-link"}).html(b)).appendTo(a),i.oApi._fnBindAction(l,{action:s},t))}}var b,u,t,m=new DataTable.Api(i),g=i.oClasses,f=i.oLanguage.oPaginate,x=i.oLanguage.oAria.paginate||{};try{t=$(a).find(document.activeElement).data("dt-idx")}catch(a){}p($(a).empty().html('<ul class="pagination"/>').children("ul"),e),void 0!==t&&$(a).find("[data-dt-idx="+t+"]").trigger("focus")};export default DataTable;
7 changes: 6 additions & 1 deletion js/dataTables.bootstrap4.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,21 @@ DataTable.ext.renderer.pageButton.bootstrap = function ( settings, host, idx, bu
}

if ( btnDisplay ) {
var disabled = btnClass.indexOf('disabled') !== -1;

node = $('<li>', {
'class': classes.sPageButton+' '+btnClass,
'id': idx === 0 && typeof button === 'string' ?
settings.sTableId +'_'+ button :
null
} )
.append( $('<a>', {
'href': '#',
'href': disabled ? null : '#',
'aria-controls': settings.sTableId,
'aria-disabled': disabled ? 'true' : null,
'aria-label': aria[ button ],
'aria-role': 'link',
'aria-current': btnClass === 'active' ? 'page' : null,
'data-dt-idx': button,
'tabindex': settings.iTabIndex,
'class': 'page-link'
Expand Down

0 comments on commit 836f04f

Please sign in to comment.