WebAIM - Web Accessibility In Mind

E-mail List Archives

Thread: Query on landing the focus

for

Number of posts in this thread: 3 (In chronological order)

From: Vemaarapu Venkatesh
Date: Mon, Jul 15 2019 2:30AM
Subject: Query on landing the focus
No previous message | Next message →

Hello everyone, Greetings!

I have a web page with static text alone and only one heading (h1) at the
top. While reading the page using screen reader, an alert dialog pops up
shifting the focus there to confirm it. Once confirming it where I should
expect the focus?
If the focus resets to top of the page, that may annoy users as they must
navigate all the way again.
To set the focus back to same area it is not the interactive item instead
the dialog emerges while reading a paragraph. Is there any mechanism to set
the focus back to same line from where user stops reading?

Thanks for your insights in advance.

Thanks,
Venkatesh

From: Mark Magennis
Date: Mon, Jul 15 2019 2:50AM
Subject: Re: [EXTERNAL] Query on landing the focus
← Previous message | Next message →

Hi Venkatesh,

Your thinking seems to be correct. It makes most sense to set focus back to the same point it was at when the alert appeared. It doesn't matter that this is not an interactive item. Focus is often set to non-interactive items such as the main region in a "Jump to main content" link. Make sure you don't show a visible focus indicator on whatever you set focus back to.

However, since the alert wasn't in response to a user action (at least that's what I understand from your description), I can't see how it's possible to know what the screen reader was reading when the alert appeared. Maybe others on the list might know how this could be done. If that's not possible, I'd say the safest thing would be to set focus back to the h1.

Mark

Mark Magennis
Skillsoft | mobile: +353 87 60 60 162
Accessibility Specialist


-----Original Message-----
From: WebAIM-Forum < = EMAIL ADDRESS REMOVED = > On Behalf Of Vemaarapu Venkatesh
Sent: 15 July 2019 09:31
To: = EMAIL ADDRESS REMOVED =
Subject: [EXTERNAL] [WebAIM] Query on landing the focus

Hello everyone, Greetings!

I have a web page with static text alone and only one heading (h1) at the
top. While reading the page using screen reader, an alert dialog pops up
shifting the focus there to confirm it. Once confirming it where I should
expect the focus?
If the focus resets to top of the page, that may annoy users as they must
navigate all the way again.
To set the focus back to same area it is not the interactive item instead
the dialog emerges while reading a paragraph. Is there any mechanism to set
the focus back to same line from where user stops reading?

Thanks for your insights in advance.

Thanks,
Venkatesh

From: Patrick H. Lauke
Date: Mon, Jul 15 2019 2:55AM
Subject: Re: [EXTERNAL] Query on landing the focus
← Previous message | No next message

On 15/07/2019 09:50, Mark Magennis wrote:
> Hi Venkatesh,
>
> Your thinking seems to be correct. It makes most sense to set focus back to the same point it was at when the alert appeared. It doesn't matter that this is not an interactive item. Focus is often set to non-interactive items such as the main region in a "Jump to main content" link. Make sure you don't show a visible focus indicator on whatever you set focus back to.
>
> However, since the alert wasn't in response to a user action (at least that's what I understand from your description), I can't see how it's possible to know what the screen reader was reading when the alert appeared. Maybe others on the list might know how this could be done. If that's not possible, I'd say the safest thing would be to set focus back to the h1.

Without trying it, off the top of my head I'd say you could try, as part
of the code that pops up the alert in the first place, storing the value
of document.activeElement and when the popup is closed, programmatically
setting tabindex="-1" on that explicitly, calling the focus() method,
and removing the tabindex="-1" again.

This will only ensure the actual focused/active element gets focused.
This will be different from the virtual cursor/reading cursor of the AT.
I actually suspect that for a page with no focusable/interactive
controls, document.activeElement will simply be the <body> ... and if
that's the case, there's likely no way to move focus back explicitly to
where the virtual focus was at the time since that's not something
exposed to the JS.

Long story short, if the above yields no good results, then it's simply
something that can't be done, and the only option (other than just
losing focus altogether) would be to refocus the start of the document.

P
--
Patrick H. Lauke

www.splintered.co.uk | https://github.com/patrickhlauke
http://flickr.com/photos/redux/ | http://redux.deviantart.com
twitter: @patrick_h_lauke | skype: patrick_h_lauke