Forum Discussion
Clicking a button while setting focus
- 5 days ago
Hi AaronBurgessAU there is a hack for this. As I say, it's not a documented feature, but something I have used to force the screen reader to announce content and retain focus. I have tested with JAWS NVDA and Windows Narrator and it has worked consistently.
What I do is use a layer, the layer should have the following properties:
Then add your string of text to the layerand position the text just off-screen (you don't want to see it flash up when the layer is shown). You also want the layer to be blank (transparent background) so it is not seen when shown.
Then set the layer timeline to very very short:
Give your layer a name so you remember what it is and don't accidentally delete it:
Then, whenever you want that text announced to the screen reader, just show the layer. I think the key property on the layer that makes the screen reader announce the content is Prevent the user from click on the other layers.
The layer has a very short timeline, and hides itself, returning the focus to the button that triggered the layer. You may just have to tweak if it doesn't work and just ensure there is enough time for the text in the layer to be put into the screen readers buffer.
Cheers,
Sam
Hi AaronBurgessAU there is a hack for this. As I say, it's not a documented feature, but something I have used to force the screen reader to announce content and retain focus. I have tested with JAWS NVDA and Windows Narrator and it has worked consistently.
What I do is use a layer, the layer should have the following properties:
Then add your string of text to the layerand position the text just off-screen (you don't want to see it flash up when the layer is shown). You also want the layer to be blank (transparent background) so it is not seen when shown.
Then set the layer timeline to very very short:
Give your layer a name so you remember what it is and don't accidentally delete it:
Then, whenever you want that text announced to the screen reader, just show the layer. I think the key property on the layer that makes the screen reader announce the content is Prevent the user from click on the other layers.
The layer has a very short timeline, and hides itself, returning the focus to the button that triggered the layer. You may just have to tweak if it doesn't work and just ensure there is enough time for the text in the layer to be put into the screen readers buffer.
Cheers,
Sam
I really like this solution.. my initial thoughts when I read the post was a JavaScript solution triggered on each button would be the way to go. The outcome would be similar but you wouldn’t have to worry about the focus moving and the timeline tuning you mentioned.
Related Content
- 2 years ago