NEW 263069
AX: VoiceOver on iOS moves focus away, even when HTMLElement.focus() is called on an element
https://bugs.webkit.org/show_bug.cgi?id=263069
Summary AX: VoiceOver on iOS moves focus away, even when HTMLElement.focus() is calle...
Domantas Petrauskas
Reported 2023-10-12 05:27:55 PDT
Created attachment 468186 [details] Screen recording of focus bug reproduction When navigating in a multi-step UI, where currently focused element disappears when navigating between steps, the VoiceOver cursor & browser focus jumps to the "closest" element after a brief moment, even when forcing focus on another element via HTMLElement.focus(). Steps to reproduce: 1. Open https://f76xpz.csb.app/ on iOS with VoiceOver. Open console to view logs. 2. Click on "Next step" button" 3. Observe focus being set on "Previous step" button and then jumping to "Save and continue" a few milliseconds later. Expected result: Focus should get set and remain on "Previous step" button Actual result: Focus gets set on "Previous step", but then jumps on "Save and continue". I'm assuming VoiceOver always needs to have a focus on an element, so when the currently focused element disappears, VoiceOver focuses the element "closest" to the position where the focused element was. However, this happens after a brief delay, so even if you set the focus manually on another element, VoiceOver overrides it. It is important to respect the HTMLElement.focus() in order to comply with WCAG 2.1 Standard Focus Order success criterion: https://www.w3.org/TR/WCAG21/#focus-order The issue is not reproducible on Mac VoiceOver. Setting tabIndex on "Previous step" button does not change the behaviour in any way.
Attachments
Screen recording of focus bug reproduction (2.41 MB, video/quicktime)
2023-10-12 05:27 PDT, Domantas Petrauskas
no flags
Radar WebKit Bug Importer
Comment 1 2023-10-12 05:28:05 PDT
marc.solomon
Comment 2 2024-05-02 11:05:34 PDT
This issue may be related to Bug 273635 - AX: VoiceOver cursor does not sync with browser focus after closing dialog when interactive element is positioned behind it.
Note You need to log in before you can comment on or make changes to this bug.