I have a messagebox in the ZK Framework that pops up when the user enters invalid input. It behaves as expected. We are trying to make JAWS and other screenreaders read the text of the box when it pops up.
{
Messagebox
.show("Verify that the correct Employee ID Number and/or last four of SSN were entered", "Error", Messagebox.OK, Messagebox.ERROR, -1);
}
The -1 at the end is to set the focus:
http://www.zkoss.org/javadoc/7.0.2/zk/org/zkoss/zul/Messagebox.html#show(int, int, int, java.lang.String, int)
but it sets the focus to the button itself, I've tried numbers ranging from -5 to 5 hoping it would use the button as a starting point, but that does not work. The screenreader will read the message if you use the mouse to click on it, so I know it's possible for the text to be read, but the requirement is that it's automatically read when it pops up.
Does anyone know of a way to make this happen?
Instead of using the built-in ZK MessageBox functionality, you can use the org.zkoss.zk.ui.util.Clients.evalJavaScript()
function to call a JavaScript alert. This will bring focus to the popup. Although it will not be in a pretty ZK window, screen readers should read it.
Here's an example:
org.zkoss.zk.ui.util.Clients.evalJavaScript("alert('This is a popup message')");