Bug 211934 - AX: aria-modal="true" autofocuses the first focusable child when inside an iframe
Summary: AX: aria-modal="true" autofocuses the first focusable child when inside an if...
Status: RESOLVED WORKSFORME
Alias: None
Product: WebKit
Classification: Unclassified
Component: Accessibility (show other bugs)
Version: Safari 13
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-05-14 16:53 PDT by Devon Govett
Modified: 2021-02-01 12:08 PST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Devon Govett 2020-05-14 16:53:48 PDT
When rendering a dialog with `aria-modal="true"` inside an iframe, Safari auto focuses the first focusable child of the dialog, even though the dialog itself is focused by JavaScript. No other browsers seem to have this behavior.

Reproduction: https://b3gkn.csb.app - the close button will be auto focused in Safari, after a flash of focus being on the dialog itself.
Opening the iframe page directly does not cause the issue: https://b3gkn.csb.app/iframe.html.

Source code for the reproduction: https://codesandbox.io/s/objective-currying-b3gkn?file=/index.html

I wouldn't expect the browser to auto focus anything with `aria-modal="true"` (AFAIK no other browsers do this), but if it does, it should respect the element that the developer focuses with JavaScript.
Comment 1 Radar WebKit Bug Importer 2020-05-14 16:53:58 PDT
<rdar://problem/63249533>
Comment 2 chris fleizach 2021-02-01 12:05:58 PST
(In reply to Radar WebKit Bug Importer from comment #1)
> <rdar://problem/63249533>

on iOS, VoiceOver can't focus on a "group" like a dialog. it needs to focus on one of the flat elements in the list of elements to navigate. I think in the absence of further guidance it picks an element to land on.