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

Add aria-label to page length select for accessibility #252

Open
wants to merge 1 commit into
base: master
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ A number of programs are required out your computer to be able to build DataTabl
* [Sass](https://sass-lang.com/install) - CSS compiler
* [JSHint 2.1+](https://jshint.com/install/) - Linter (optional)

PHP Libraries

* [libcurl](https://curl.se/) (On ubuntu `sudo apt-get install php-curl`)
* xml (On ubunutu `sudo apt-get install php-xml`)

The build script assumes that a Mac or Linux environment is being used - Windows builds are not currently directly supported (although would be possible using [Cygwin](https://www.cygwin.com/)). Additionally, you may need to alter the paths for the above programs to reflect where they are installed on your own computer - this can be done in the [`build/include.sh`](build/include.sh) script.

The output files are placed into `built/DataTables/` which is a temporary directory. No changes should be made in that directory as they will be **overwritten** when you next build the software.
Expand Down
6 changes: 3 additions & 3 deletions build/lib/markdown.php
Original file line number Diff line number Diff line change
Expand Up @@ -1656,9 +1656,9 @@ function _initDetab() {
# regular expression.
#
if (function_exists($this->utf8_strlen)) return;
$this->utf8_strlen = create_function('$text', 'return preg_match_all(
"/[\\\\x00-\\\\xBF]|[\\\\xC0-\\\\xFF][\\\\x80-\\\\xBF]*/",
$text, $m);');
$this->utf8_strlen = function($text) {
return preg_match_all("/[\\x00-\\xBF]|[\\xC0-\\xFF][\\x80-\\xBF]*/", $text, $m);
};
}


Expand Down
6 changes: 5 additions & 1 deletion build/make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ function build_js {
else
echo_error "JSHint failed"
fi
else
echo_msg "No JSHint installed"
fi

js_compress $OUT_FILE
Expand Down Expand Up @@ -375,8 +377,10 @@ function usage {
#
cd $BASE_DIR

CURR_BRANCH="$(git rev-parse --abbrev-ref HEAD)"

echo ""
echo_section "DataTables build ($VERSION) - branch: $SYNC_BRANCH"
echo_section "DataTables build ($VERSION) - branch: $CURR_BRANCH"
echo ""


Expand Down
4 changes: 3 additions & 1 deletion js/core/core.length.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ function _fnFeatureHtmlLength ( settings )
menu = settings.aLengthMenu,
d2 = Array.isArray( menu[0] ),
lengths = d2 ? menu[0] : menu,
language = d2 ? menu[1] : menu;
language = d2 ? menu[1] : menu,
oAria = settings.oLanguage.oAria;

var select = $('<select/>', {
'name': tableId+'_length',
'aria-controls': tableId,
'aria-label': oAria.sPageLength,
'class': classes.sLengthSelect
} );

Expand Down
23 changes: 22 additions & 1 deletion js/model/model.defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -1440,7 +1440,28 @@ DataTable.defaults = {
* } );
* } );
*/
"sSortDescending": ": activate to sort column descending"
"sSortDescending": ": activate to sort column descending",

/**
* ARIA label that is added to the length select list
* @type string
* @default : Page Length
*
* @dtopt Language
* @name DataTable.defaults.language.aria.sortDescending
*
* @example
* $(document).ready( function() {
* $('#example').dataTable( {
* "language": {
* "aria": {
* "pageLength": " - Page Length Select Menu"
* }
* }
* } );
* } );
*/
"sPageLength": "Page Length"
},

/**
Expand Down