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-expanded and title attributes for accessibility improvements #135

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pczarn2
Copy link
Contributor

@pczarn2 pczarn2 commented Oct 22, 2024

Add aria-expanded and title attributes to first cell of each row so that when someone tabs to them they will hear "click to expand" or "click to collapse" in the screen reader. Also, if user hovers above the cell with their mouse, they will see a title with the same language.

Note: these new changes can be tested with the Basic Responsive and other examples (https://datatables.net/extensions/responsive/examples/initialisation/option.html), but there is an issue where tabbing doesn't work correctly until rows are sorted few times. (see reported Issue #134 ). To test the proposed accessibility improvement changes in this pull request, please click the sorting buttons several times in the DataTable before testing.

Changes have been tested with NVDA and JAWS. I don't have a way to test with Voice Over.

Add aria-expanded and title attributes to first cell of each row so that when someone tabs to them they will hear "click to expand" or "click to collapse" in the screen reader. Also, if use hovers above the cell with their mouse, they will see a title with the same language. 

Note: these new changes can be tested with the Basic Responsive and other examples (https://datatables.net/extensions/responsive/examples/initialisation/option.html), but there is an issue where tabbing doesn't work correctly until rows are sorted few times. (see reported Issue DataTables#134 ). To test the proposed accessibility improvement changes, please click the sorting buttons several times in the datatable.
@pczarn2 pczarn2 changed the title Add aira-expanded and title attributes for accessibility improvements Add aria-expanded and title attributes for accessibility improvements Oct 22, 2024
AllanJard added a commit that referenced this pull request Oct 23, 2024
…ctly

Fix: `tabindex` could incorrectly be applied to the final column when Ajax loading data

#135
@AllanJard
Copy link
Contributor

Oops - didn't mean to reference this issue with that commit - it was meant for #134 !

AllanJard pushed a commit to DataTables/Dist-DataTables-Responsive that referenced this pull request Oct 23, 2024
… accessability wasn't being applied correctly

Fix: `tabindex` could incorrectly be applied to the final column when Ajax loading data

DataTables/Responsive#135

Sync to source repo @079d776d2c7eaf9f0131b195d41da7afccc8e3dd
AllanJard pushed a commit to DataTables/Dist-DataTables-Responsive-DataTables that referenced this pull request Oct 23, 2024
… accessability wasn't being applied correctly

Fix: `tabindex` could incorrectly be applied to the final column when Ajax loading data

DataTables/Responsive#135

Sync to source repo @079d776d2c7eaf9f0131b195d41da7afccc8e3dd
AllanJard pushed a commit to DataTables/Dist-DataTables-Responsive-Bootstrap that referenced this pull request Oct 23, 2024
… accessability wasn't being applied correctly

Fix: `tabindex` could incorrectly be applied to the final column when Ajax loading data

DataTables/Responsive#135

Sync to source repo @079d776d2c7eaf9f0131b195d41da7afccc8e3dd
AllanJard pushed a commit to DataTables/Dist-DataTables-Responsive-Foundation that referenced this pull request Oct 23, 2024
… accessability wasn't being applied correctly

Fix: `tabindex` could incorrectly be applied to the final column when Ajax loading data

DataTables/Responsive#135

Sync to source repo @079d776d2c7eaf9f0131b195d41da7afccc8e3dd
AllanJard pushed a commit to DataTables/Dist-DataTables-Responsive-jQueryUI that referenced this pull request Oct 23, 2024
… accessability wasn't being applied correctly

Fix: `tabindex` could incorrectly be applied to the final column when Ajax loading data

DataTables/Responsive#135

Sync to source repo @079d776d2c7eaf9f0131b195d41da7afccc8e3dd
AllanJard pushed a commit to DataTables/Dist-DataTables-Responsive-SemanticUI that referenced this pull request Oct 23, 2024
… accessability wasn't being applied correctly

Fix: `tabindex` could incorrectly be applied to the final column when Ajax loading data

DataTables/Responsive#135

Sync to source repo @079d776d2c7eaf9f0131b195d41da7afccc8e3dd
AllanJard pushed a commit to DataTables/Dist-DataTables-Responsive-Bootstrap4 that referenced this pull request Oct 23, 2024
… accessability wasn't being applied correctly

Fix: `tabindex` could incorrectly be applied to the final column when Ajax loading data

DataTables/Responsive#135

Sync to source repo @079d776d2c7eaf9f0131b195d41da7afccc8e3dd
AllanJard pushed a commit to DataTables/Dist-DataTables-Responsive-Bootstrap5 that referenced this pull request Oct 23, 2024
… accessability wasn't being applied correctly

Fix: `tabindex` could incorrectly be applied to the final column when Ajax loading data

DataTables/Responsive#135

Sync to source repo @079d776d2c7eaf9f0131b195d41da7afccc8e3dd
AllanJard pushed a commit to DataTables/Dist-DataTables-Responsive-Bulma that referenced this pull request Oct 23, 2024
… accessability wasn't being applied correctly

Fix: `tabindex` could incorrectly be applied to the final column when Ajax loading data

DataTables/Responsive#135

Sync to source repo @079d776d2c7eaf9f0131b195d41da7afccc8e3dd
@AllanJard
Copy link
Contributor

Let me have a little think about this one. It sounds like a good idea in principle, particularly the aria attributes. It would need i18n support though, and I don't really want title attributes by default. I'll have a think :-)

@pczarn2
Copy link
Contributor Author

pczarn2 commented Oct 23, 2024

@AllanJard Sounds good. Thanks for considering it :)

@pczarn2
Copy link
Contributor Author

pczarn2 commented Oct 23, 2024

@AllanJard with the new tab indexes code, the following lines of code are no longer needed (they will cause a small bug that overwrites the titles/aria-expanded during table resizing on the rows that were collapsed before resize.

image

@AllanJard
Copy link
Contributor

Thanks - I'll keep that in mind when I come to this.

@pczarn2
Copy link
Contributor Author

pczarn2 commented Oct 23, 2024

@AllanJard I just had a thought that maybe instead of using title attributes, maybe tooltips like this would be better? https://a11y.nicolas-hoffmann.net/simple-tooltip/ Something to consider once you have time to look at this again.

@AllanJard
Copy link
Contributor

Thanks for the suggestion. JS driven tooltips are a lot more flexible, but I won't be adding a dependency to this library (other than DataTables and jQuery of course). If someone wants to use an external tooltip library they can run it on the generated table.

@pczarn2
Copy link
Contributor Author

pczarn2 commented Oct 23, 2024

Makes sense. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants