TheJavaBeast
TheJavaBeast

Reputation: 163

GWT-508 compliant- How to set HTML tags

I am in the process of making my GWT page 508 compliant and I need to add some additional information on the sort buttons in my cellTable for the screen reader to pick up. Basically I need to know how to set the Label HTML tag from the cellTable.

I know how to use the setTitle() and setAlt() methods but I can't seem to find an easy way to set the Label for buttons. I understand screen readers can optionally view Title tags but that is not what I want to have to do.

I cant seem to find anyone else out there with this problem, how has this not come up more?

Upvotes: 0

Views: 330

Answers (1)

Thomas Broyer
Thomas Broyer

Reputation: 64541

There's a TODO in the code actually: https://gwt.googlesource.com/gwt/+/2.6.0/user/src/com/google/gwt/user/cellview/client/DefaultHeaderOrFooterBuilder.java

// TODO: Figure out aria-label and translation of label text

and there doesn't seem to be any hack/hook to add it.

So the only solution seems to be to fork/patch GWT (and if possible contribute the patch upstream).

BTW, the sort icons are not buttons, just indicators. The whole table header responds to click, so the aria-label has to be added to the <th> element.

(well, actually, there seems to be a workaround: walk the table DOM looking for the appropriate <th> element and add the aria-label attribute using Roles.getButtonRole().setAriaLabelProperty(); but fixing GWT would be less fragile, much better in the long run and good for everyone)

Upvotes: 1

Related Questions