Bug 163719 - AX: navigating to a new URL with a fragment identifier, VoiceOver moves accessibility focus to top of document regardless
Summary: AX: navigating to a new URL with a fragment identifier, VoiceOver moves acces...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Accessibility (show other bugs)
Version: Safari 10
Hardware: iPhone / iPad iOS 10
: P2 Major
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2016-10-20 02:15 PDT by Patrick H. Lauke
Modified: 2017-06-21 07:56 PDT (History)
4 users (show)

See Also:


Attachments
Test case (5.26 KB, text/html)
2016-10-20 02:15 PDT, Patrick H. Lauke
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick H. Lauke 2016-10-20 02:15:36 PDT
Created attachment 292162 [details]
Test case

When opening a URL with a fragment identifier, Safari correctly opens the new page and visually scrolls to the relevant part of the document referred to in the fragment/hash (if present). However, when VoiceOver is running, after the initial visual scroll VoiceOver resets the accessibility focus/caret all the way back to the first element at the very start of the document. This currently makes URLs with fragment identifiers useless for iOS/VO users (which is particularly problematic for very long documents, as VO users then have to still explicitly navigate all the way through the document to finally reach the actual section they were after).

Video of the bug in action: https://www.youtube.com/watch?v=LvlM8Z71oWE

Steps to reproduce:

- with VoiceOver enabled, open a fresh tab in Safari
- enter a URL with a fragment identifier (in the attached test case, there is a #target1, for instance)

Expected:

- Safari opens the document, visually scrolls to the location of the fragment identifier
- VoiceOver sets accessibility focus/caret to the targeted element (or its first child element)

Actual:

- Safari opens the document, visually scrolls to the location of the fragment identifier
- VoiceOver sets accessibility focus/caret to the very first element of the document
- the visual viewport is scrolled back to the top of the document

This is potentially a side effect of https://bugs.webkit.org/show_bug.cgi?id=116046, but filed separately as requested https://bugs.webkit.org/show_bug.cgi?id=116046#c57
The issue does not appear in Safari/VoiceOver on MacOS/OS X, so it seems iOS/Safari/VoiceOver specific.
Comment 1 Radar WebKit Bug Importer 2016-10-20 02:54:55 PDT
<rdar://problem/28866720>
Comment 2 Anika Henke 2017-06-21 07:56:47 PDT
It seems Safari iOS with VoiceOver always has its virtual focus on the first thing on the page after a page refresh or opening any page. No matter if you try to focus on another element via linking to an anchor or do the focus via JavaScript or use an input with the HTML5 autofocus attribute (all of which I've tried), the result is always the same, Safari/VO's virtual focus will be at the very top of the page. (The actual browser focus stays where it is supposed to be, only the virtual focus is affected.)

I've got another reduced test case for this:

1. Activate VoiceOver on an iOS device
2. Open http://jsbin.com/cadocaj in Safari
3. Submit the form

The browser focus (which I have made visible with a dotted blue outline) will be correctly on the error message and the virtual focus is on there as well at first. But after a split second the virtual focus will move to the first thing on the page, i.e. the heading. The time it takes for that "re-focus" is somewhat unpredictable. Sometimes VO manages to read the whole message, sometimes it just reads the first two words, and sometimes it skips it altogether.

You can see another example in the wild here: http://govuk-elements.herokuapp.com/errors/example-form-validation-multiple-questions. After submitting the form, the virtual focus will end up wrongly on the skip link at the top and not on the error message box.