Accessibility: setting aria-label different to columns.title

Accessibility: setting aria-label different to columns.title

TimmeehTimmeeh Posts: 2Questions: 1Answers: 0
edited June 2021 in General

Hi, I need help w/ my column-title in the aria-label to be different than it's visual-innerHTMLText:

Definition:
<th>A</th>

DataTable-result:
<th aria-label="A: sorting-string[asc/desc]">A</th>

I need:
<th aria-label="B: sorting-string[asc/desc]">A</th>

Why is this a problem for me?: because my language has feminine & masculine nouns and because of accessibility, gender-equality- and availiable-website-space reasons we have to explicitly say both the feminine & masculine word. To make text (Column-header) more readable we shorten/merge the two words for the feminine & masculine into a single word w/ use of an asterisk''. Now: Screen-readers(SR) will read the '' aloud so we have to make the SR say the long two-word version instead of the visually-present shortened one.

What I've tried so far:
manual set aria-label in definition are dT- overwritten
in DataTable initialization: with columnDefs: Setting column-title manually: cannot set aria-label
setting aria-label via "initComplete"-dT-event: aria-label get overwritten when operating sorting

What DataTable ""is doing wrong(ur doing fantastic!!!)"":
in Initialization:
it would be cool if one could provide an alias-string for the title before creating the DataTable to make the aria-labels (spec. with sorting) even more customizable o:)

Thank you very much in advance for any help!!! B)
Greetings, Tim.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    H Tim,

    Sounds like a good idea to me - I've committed in the change required and you can now use a columns.ariaTitle option - e.g.:

    $(document).ready(function() {
        $('#example').DataTable({
            columnDefs: [
                {
                    ariaTitle: 'Aria only title',
                    targets: 0
                }
            ]
        });
    } );
    

    It will be part of the 1.10.25 release, which shouldn't be too far away. Until then the nightly will carry this change shortly.

    Allan

  • TimmeehTimmeeh Posts: 2Questions: 1Answers: 0

    <3

Sign In or Register to comment.