-
-
Notifications
You must be signed in to change notification settings - Fork 425
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
make scrollbody focusable #297
base: master
Are you sure you want to change the base?
Conversation
When there's a scrollable table, it would be nice to focus to the scrollbody so that we can use keyboard to scroll
Thanks for the suggestion! I rather like this - it is however the first time I've encountered this request, so I'm not going to immediately pull it in, but let's see if there is any other feedback from others who would like this. |
It looks like this example already has the focus on the tbody during tabbing: https://datatables.net/extensions/responsive/examples/styling/scrolling.html |
Here is a comment from our QA/Accessibility team member. Hmm, not 100% sure if I understand the question and situation, though I know enough to make one comment. As long as just a keyboard can be used to navigate/scroll through a table where only some of it visible at a time, that seems fine. If someone using just a keyboard cannot see part of the data table, then that’s where the issue comes up. Giving the scroll body keyboard focus does introduce an unpleasant interaction with screen readers, though. NVDA starts to read the contents of the ENTIRE table while JAWS still stuck and reads little/nothing, which is confusing for the user. |
@pczarn2 Thank you! I completely overlooked the usecase of screen reader. (Sorry I have no experience with it). So it would be better not to focus the scroll body, but focus to the cells instead (as in the examples that have focusable cells). If someone want to do that, then they can manually use the render function (example) to do that. This PR should then not be merged and developers should manually ensure the accessibility. |
I think so too. The first example you gave (https://datatables.net/extensions/keytable/examples/initialisation/simple.html) seems to be best use for this particular case. |
If there is a scrollable table, it would be nice to focus on the scrollbody so that we can use the keyboard to scroll.
This PR adds the tab index to the scrollbody according to the value:
DataTablesSrc/js/model/model.defaults.js
Line 491 in daa37b2
Result:
Note: It seems to be redundant if KeyTable Plugin is used, as keyboard navigation is already available for cells.
Example: https://datatables.net/extensions/keytable/examples/initialisation/scrolling.html