DataTables / DataTablesSrc

DataTables source repository
https://datatables.net
MIT License
587 stars 422 forks source link

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

Open Banner-Keith opened 7 months ago

Banner-Keith commented 7 months ago

I have added an aria-label attribute to the length select menu. I tried to follow the pattern I had seen on the sort element aria code using oAria settings.

I ended up running the make file build scripts and during that I found that create_function was removed from the newest major version of PHP. I have switched over to an anonymous function. It didn't seem to cause any issues on my end but if you'd prefer that I remove that part from this PR I would be more than happy to do so.

I also noticed that the build script would always print out that you were building master even if that wasn't true, so I tweaked it to show the current branch so it's not confusing. Once again, I can remove that if you prefer.

I have built and copied the output into a working site on one of my active internal projects and it worked great with no defects that I have noticed.

Please let me know if there's anything you'd like me to tweak.

This is a very minor change so I'm hoping it can go out before version 2.0 if you decide to publish another version.

AllanJard commented 7 months ago

Hi - thanks for this! All development for DataTables is currently happening on the 2 branch - the master is currently only getting bug fixes and I think this would probably qualify as a new feature.

With 2 I've changed the page length control a little bit to try and improve accessibility - the select is now outside of the label and an explicit binding is used. It seems that a lot of screenreaders didn't like the previous implicit binding. The wording as changes a little to reflect this as well. You can see a WIP example here: http://datatables.net/dev/2/examples/basic_init/zero_configuration.html .

Would you say that still needs an aria-label on it?