This post is going to be my ever updating journal to record many learnings which I learned by implementation, from peers, some hints from blogs, sites etc. Main intent is to record everything that is not available in stackoverflow and links for everything available in stackoverflow for reference ona11y
.
Screen readers used:
- Voiceover (iOSv15)
- Android Talkback
Cookbook recipes
List item element receiving focus, announcing "bullet"
CSS can help fix this issue by sayinglist-style-type: none
Link vs Button on pages
When we have a user action causing redirection/navigation to another URL, therole
should belink
. But in cases where the user actions is causing pop-ups etc, it should bebutton
.
Using flexbox to prevent screen-reader focus
I have not come across any articles explaining this, but when we have the children asflexbox
, the screen-reader just focuses on parent container. If you havearia-label
on the parent toflexbox
, it reads it. Else falls back to reading the contents combined.
Removingtabindex
for talkback to prevent focus
In Android, when we havetabindex
set, it becomes eligible for receiving focus, irrespective of its value. So, its text contents are read. Removal of that attribute prevents the focus.
Announcing status or toast updates
using HTML attributes
This method involves creating alive-region
and setting politeness for announcing the alerts.
using JS
This itself involves having multiple approaches. One of them is to create a singleton placeholder and push content inside this region. The attributes likearia-hidden
,aria-live
etc needs to be set and this can be unset after some fixed/dynamic timeout duration.
Focus elements on page load in voiceover in Javascript
This is the best I have come across to achieve this. Tried using variousfocusInterval
withsetTimeout
instead ofsetInterval
but faced certain drawbacks each time.
When30ms
is used withsetTimeout
, focus was missing for some cases. With50ms
, the default focus announces an element followed by shift in focus to read the current one.
Understanding screen reader behaviours
tabindex
interpretation
In the codepen above, various scenarios oftabindex
are added on both parent and child. Invoiceover
thetabindex
attributes are not considered much and screen-reader focuses mainly on presence of text/content rather than the attribute. Whereas fortalkback
, based on how we specify thetabindex
the behaviour changes drastically. Example:
- When we have
tabindex
only on parent: the focus does not come to the child element since the parent already has the attribute. - When both parent and child has the attribute: the focus comes to both of them and inner content read repetition happens.
- When there in attribute only on child: it is equivalent of no attribute because the child being a text node, it will naturally receive the focus.
- No attribute anywhere: same as case 3
Top comments(10)

- LocationUnited Kingdown
- WorkHead of Accessibility - SFG20
- Joined
As the accessibility tag on SO is where I spend most of my time if you ever struggle to find something on there let me know, odds are I have answered it before! ❤️

- LocationBangalore, India
- WorkSenior Frontend Engineer at Linkedin
- Joined
Thanks a tonne@inhuofficial for your support 🙏.
As next task, I was trying to find a way to trigger aonclick
on abutton
using Voiceover. It works using mouse click only. Can you please help me on this?

- LocationUnited Kingdown
- WorkHead of Accessibility - SFG20
- Joined
Sure, are you using an inlineonclick
on the button oraddEventListener('click'
.
Also are you using a framework or is this vanilla (as a lot of frameworks break the native functionality of "click")

- LocationBangalore, India
- WorkSenior Frontend Engineer at Linkedin
- Joined
We are usingaddEventListener
in Vanilla JS

- LocationUnited Kingdown
- WorkHead of Accessibility - SFG20
- Joined
Hmm sorry to be all "stack overflow" about it but do you have a fiddle that replicates this? Aclick
handler will work on a native<button>
without issue unless there is something else interfering.
Also is your VoiceOver on Mac or Mobile just so I know which to test with!

- LocationBangalore, India
- WorkSenior Frontend Engineer at Linkedin
- Joined
Yeah sure. I will try to replicate the issue in fiddle and share the link soon. Thanks in advance for your quick responses :-)

- LocationUnited Kingdown
- WorkHead of Accessibility - SFG20
- Joined
No problem, anyone working on accessibility is a super star in my book so I will help when I can! ❤️

- LocationBangalore, India
- WorkSenior Frontend Engineer at Linkedin
- Joined
Hello@inhuofficial, I have a codepen (codepen.io/snow650/pen/rNYjKxV) where the focus by Android TalkBack should be only on outermost anchor tag only. It should not be able to focus inner span elements. Any suggestions on how to achieve this?

- LocationUnited Kingdown
- WorkHead of Accessibility - SFG20
- Joined
Not sure what you mean, there is a difference between focus states and where the review cursor is on a screen reader, is that what you mean? It isn't actually focusing anything and your markup is valid, there is probably nothing you need to do but I thought I would check I have understood properly.

- LocationBangalore, India
- WorkSenior Frontend Engineer at Linkedin
- Joined
I would like to send a screen recording to explain what I am try to achieve. Not able to attach video here. Can I please have your email/chat ID to send?
For further actions, you may consider blocking this person and/orreporting abuse