Skip to content

shouldReturnFocusAfterClose doesn't work in iOS Safari #858

Open
@vladpopovv

Description

@vladpopovv

Summary:

The logic of shouldReturnFocusAfterClose doesn't work in iOS Safari

Environment info: iphone 11, iOS 14.4.1

Steps to reproduce:

  1. Open the sandbox example in Safari on iOS
  2. Open modal by clicking on the Open modal button
  3. Close button by clicking on overlay space
  4. Focus doesn't return to the button. The button should have red background because of the focused styles)
RPReplay_Final1616944898.mp4

Expected behaviour:

The focus should return to the button. (In the sandbox example, the button should become red because of the focused styles)

Link to example of issue:

Sandbox: https://codesandbox.io/s/strange-joliot-k015k?file=/src/Modal.js:720-726
I've added focused styles to see when the button is focused(background: red)

Additional notes:

I've found a possible workaround to set the focus manually on closing modal by the button ref. How it works(expected behaviour of this bug):

RPReplay_Final1616945612.mp4

You can find this workaround in the sandbox in commented code

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions