Forum How do I...?

How to apply alternate text in any tag element?

phillipleung
Will anyone know how to apply alternate text in any tag element? For example:

<p>say something <span aria-label="number of cells">no. of cells</span></p>
mikeday
We may need to add a CSS property for this, we will investigate.
phillipleung
Thanks. Mike.
mikeday
The latest build supports a new property:

prince-alt-text: auto | none | <string>

You could use this with attr(aria-label) to apply the alternate text.
phillipleung
Excellent. Thanks Mike.
dauwhe
Why wouldn't this example be

<p>say something <abbr title="number">no.</abbr> of cells</span></p>
phillipleung
I may use not the best example.

Here is the example:

<th>No. of cells</th>

in JAWS, we can use aria-label, like:
<th aria-label="Number of cells">No. of cells</th>

in PDF, the only way to accommodate is adding the "alternate text" as "Number of cells"

There are lots of place in the document that we want to apply "alternate text". And PrinceXML doesn't have a way to apply contents to "alternate text". By using "prince-alt-text", we can apply "alternate text" any place that is needed. Mike's solution will be the best fit for all situation, like assigned from aria-label or title.
mikeday
The latest build also supports a new prince-expansion-text property, for abbr and acronym! :D
k9977
Hi, Im trying to use this attribute inside of a table tag but its not working. I believe for tables you need specify the aria-role as "table" followed with the aria-label. Is there a way to do this already? I've tried using the caption tag but that is not read with the screen reader.
phillipleung
try using attribute "summary". Here is the structure
<table summary="hello world!">...</table>

if you want alt text to override a cell, try this:

<th aria-label="percent"><span>%</span></th>

and css:
th {
prince-alt-text: attr(aria-label);
}
k9977
Unfortunately, the summary attribute is not working either. I'm using the voiceover screenreader on mac with adobe reader if that helps. The cells get read correctly, its just the table name that doesn't.
phillipleung
I am not a mac user, but I found this article regarding voiceover screenreader. You can check its table 4 as an example.

https://terrillthompson.com/tests/tablesummary.html

You may need to utilize the aria-describedby and along with summary. That way, JAWS and voiceover will work.

If that works, please let me know too. In that case, I can fix all my future document too. Thanks.
k9977
Thanks for the response, but didn't work unfortunately.
Murugan
How do I make a whole column decorative? I want the screen readers not to read that column because I am using that column to show a bar char using CSS. Is it possible ? Right now, its been read as "blank"