Skip to content

Commit 98903a5

Browse files
committed
Fix dialog re-focusing with iOS VO
1 parent 34bc815 commit 98903a5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/@react-aria/dialog/src/useDialog.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ export function useDialog(props: AriaDialogProps, ref: RefObject<FocusableElemen
4747
// or announce that it has opened until it has rendered. A workaround
4848
// is to wait for half a second, then blur and re-focus the dialog.
4949
let timeout = setTimeout(() => {
50-
if (document.activeElement === ref.current) {
50+
// Check that the dialog is still focused, or focused was lost to the body.
51+
if (document.activeElement === ref.current || document.activeElement === document.body) {
5152
isRefocusing.current = true;
5253
if (ref.current) {
5354
ref.current.blur();

0 commit comments

Comments
 (0)